This commit is contained in:
2025-10-25 03:02:53 +03:00
commit 043225d523
3416 changed files with 681196 additions and 0 deletions

View File

@@ -0,0 +1,142 @@
[logical.operations]
# 22 General utilities library [[utilities]](./#utilities)
## 22.10 Function objects [[function.objects]](function.objects#logical.operations)
### 22.10.10 Logical operations [logical.operations]
#### [22.10.10.1](#general) General [[logical.operations.general]](logical.operations.general)
[1](#general-1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L12796)
The library provides basic function object classes for all of the logical
operators in the language ([[expr.log.and]](expr.log.and "7.6.14Logical AND operator"), [[expr.log.or]](expr.log.or "7.6.15Logical OR operator"), [[expr.unary.op]](expr.unary.op "7.6.2.2Unary operators"))[.](#general-1.sentence-1)
#### [22.10.10.2](#and) Class template logical_and [[logical.operations.and]](logical.operations.and)
[🔗](#lib:logical_and)
`template<class T = void> struct logical_and {
constexpr bool operator()(const T& x, const T& y) const;
};
`
[🔗](#lib:operator(),logical_and)
`constexpr bool operator()(const T& x, const T& y) const;
`
[1](#and-1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L12815)
*Returns*: x && y[.](#and-1.sentence-1)
[🔗](#lib:logical_and%3c%3e)
`template<> struct logical_and<void> {
template<class T, class U> constexpr auto operator()(T&& t, U&& u) const
-> decltype(std::forward<T>(t) && std::forward<U>(u));
using is_transparent = unspecified;
};
`
[🔗](#lib:operator(),logical_and%3c%3e)
`template<class T, class U> constexpr auto operator()(T&& t, U&& u) const
-> decltype(std::forward<T>(t) && std::forward<U>(u));
`
[2](#and-2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L12837)
*Returns*: std::forward<T>(t) && std::forward<U>(u)[.](#and-2.sentence-1)
#### [22.10.10.3](#or) Class template logical_or [[logical.operations.or]](logical.operations.or)
[🔗](#lib:logical_or)
`template<class T = void> struct logical_or {
constexpr bool operator()(const T& x, const T& y) const;
};
`
[🔗](#lib:operator(),logical_or)
`constexpr bool operator()(const T& x, const T& y) const;
`
[1](#or-1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L12857)
*Returns*: x || y[.](#or-1.sentence-1)
[🔗](#lib:logical_or%3c%3e)
`template<> struct logical_or<void> {
template<class T, class U> constexpr auto operator()(T&& t, U&& u) const
-> decltype(std::forward<T>(t) || std::forward<U>(u));
using is_transparent = unspecified;
};
`
[🔗](#lib:operator(),logical_or%3c%3e)
`template<class T, class U> constexpr auto operator()(T&& t, U&& u) const
-> decltype(std::forward<T>(t) || std::forward<U>(u));
`
[2](#or-2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L12879)
*Returns*: std::forward<T>(t) || std::forward<U>(u)[.](#or-2.sentence-1)
#### [22.10.10.4](#not) Class template logical_not [[logical.operations.not]](logical.operations.not)
[🔗](#lib:logical_not)
`template<class T = void> struct logical_not {
constexpr bool operator()(const T& x) const;
};
`
[🔗](#lib:operator(),logical_not)
`constexpr bool operator()(const T& x) const;
`
[1](#not-1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L12899)
*Returns*: !x[.](#not-1.sentence-1)
[🔗](#lib:logical_not%3c%3e)
`template<> struct logical_not<void> {
template<class T> constexpr auto operator()(T&& t) const
-> decltype(!std::forward<T>(t));
using is_transparent = unspecified;
};
`
[🔗](#lib:operator(),logical_not%3c%3e)
`template<class T> constexpr auto operator()(T&& t) const
-> decltype(!std::forward<T>(t));
`
[2](#not-2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L12921)
*Returns*: !std::forward<T>(t)[.](#not-2.sentence-1)