*boolean-testable*

template<class B> concept __boolean_testable_impl = // exposition only |
(since C++20) | |

template<class B> concept boolean-testable = // exposition only |
(since C++20) | |

The exposition-only concept

specifies the requirements for expressions that are convertible to bool and for which the logical operators have the usual behavior (including short-circuiting), even for two different *boolean-testable*

types.
*boolean-testable*

Formally, to model the exposition-only concept `__boolean_testable_impl`

, the type must not define any member `operator&&`

and `operator||`

, and no viable non-member `operator&&`

and `operator||`

may be visible by argument-dependent lookup. Additionally, given an expression `e`

such that decltype((e)) is `B`

,

is modeled only if bool(e) == !bool(!e).
*boolean-testable*

### [edit] 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).

In specification of standard concepts, operands are defined as the largest subexpressions that include only:

- an id-expression, and
- invocations of
`std::move`, std::forward, and std::declval.

The cv-qualification and value category of each operand is determined by assuming that each template type parameter denotes a cv-unqualified complete non-array object type.

Every expression required to be equality preserving is further required to be *stable*: two evaluations of such an expression with the same input objects must have equal outputs absent any explicit intervening modification of those input objects.

Unless noted otherwise, every expression used in a *requires-expression* is required to be equality preserving and stable, and the evaluation of the expression may only modify its non-constant operands. Operands that are constant must not be modified.

### [edit] Notes

Examples of

types include bool, std::true_type, and std::bitset<N>::reference, and int*.
*boolean-testable*