.. _boolean: ************* meta::boolean ************* Defined in header ````. .. code-block:: cpp template concept boolean = meta::movable> && requires(std::remove_reference_t const& b1, std::remove_reference_t const& b2, bool const a) { { b1 } -> meta::convertible_to; { !b1 } -> meta::convertible_to; { b1 && a } -> meta::same_as; { b1 || a } -> meta::same_as; { b1 && b2 } -> meta::same_as; { a && b2 } -> meta::same_as; { b1 || b2 } -> meta::same_as; { a || b2 } -> meta::same_as; { b1 == b2 } -> meta::convertible_to; { b1 == a } -> meta::convertible_to; { a == b2 } -> meta::convertible_to; { b1 != b2 } -> meta::convertible_to; { b1 != a } -> meta::convertible_to; { a != b2 } -> meta::convertible_to; }; Pre-C++20 implementation of the :concept:`boolean` concept. ---- Concept emulation ================= .. code-block:: cpp namespace mgs { namespace meta { template struct is_boolean { /* ... */ }; template constexpr auto is_boolean_v = is_boolean::value; template >> using boolean = T; } // namespace meta } // namespace mgs Example ======= .. code-block:: cpp #include using namespace mgs::meta; static_assert(is_boolean_v, ""); static_assert(is_boolean_v, ""); static_assert(!is_boolean_v, ""); See also ======== * :ref:`movable` * :ref:`convertible_to`