|
|
|
template<class B> concept __boolean_testable_impl=std::convertible_to<B,bool>; | (1) | (since C++20) (exposition only*) |
template<class B> concept boolean-testable= | (2) | (since C++20) (exposition only*) |
The exposition-only conceptboolean-testable
specifies the requirements for expressions that are convertible tobool and for which the logical operators have the usual behavior (includingshort-circuiting), even for two differentboolean-testable
types.
Formally, to model the exposition-only concept__boolean_testable_impl
, the type must not define any memberoperator&& andoperator||, and no viable non-memberoperator&& andoperator|| may be visible byargument-dependent lookup. Additionally, given an expressione
such thatdecltype((e)) isB
,boolean-testable
is modeled only ifbool(e)==!bool(!e).
Expressions declared inrequires expressions of the standard library concepts are required to beequality-preserving (except where stated otherwise).
Examples ofboolean-testable
types includebool,std::true_type,std::bitset<N>::reference, andint*.