std::experimental::ranges::Boolean
Defined in header <experimental/ranges/concepts>
|
||
template
<
class B >
concept bool Boolean =
|
(ranges TS) | |
The concept Boolean<B>
specifies the requirements for a type usable in Boolean contexts. For Boolean
-
b1
,b2
, two lvalues of type const std::remove_reference_t <B>
Boolean<B>
is satisfied only if:
- bool (b1) == ! bool ( !b1)
- b1 && b2, b1 && bool(b2) and bool(b1) && b2 are all equal to bool(b1) && bool(b2)
- b1 || b2, b1 || bool(b2) and bool(b1) || b2 are all equal to bool(b1) || bool(b2)
- bool(b1 == b2), bool(b1 == bool(b2)) , and bool(bool(b1) == b2) are all equal to ( bool (b1) == bool (b2) )
- bool(b1 != b2), bool (b1 ! = bool (b2) ) , and bool ( bool (b1) ! = b2) are all equal to ( bool (b1) ! = bool (b2) )
Equality preservation
An expression is equality preserving if it results in equal outputs given equal inputs.
- The inputs to an expression consist of its operands.
- The outputs of an expression consist of its result and all operands modified by the expression (if any).
Every expression required to be equality preserving is further required to be stable
Unless noted otherwise, every expression used in a requires-expression
Implicit expression variations
A requires-expression implicit expression variations
Notes
Examples of Boolean
types include bool, std::true_type, and
std::bitset
<N>
::
reference
. Pointers are not Boolean
A deduction constraint of the form
{ expression }
-
> Same<T>
&&
effectively requires
decltype((expression))&&
to be the exact same type as T&&