boolean-testable

The exposition-only concept boolean-testable 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.

# Declarations

template< class B >
concept __boolean_testable_impl = std::convertible_to<B, bool>;

(since C++20) (exposition only*)

template< class B >
concept boolean-testable =
__boolean_testable_impl<B> &&
requires (B&& b) {
{ !std::forward<B>(b) } -> __boolean_testable_impl;
};

(since C++20) (exposition only*)

# Notes

Examples of boolean-testable types include bool, std::true_type, std::bitset::reference, and int*.