.. _byte_type: ***************** codecs::byte_type ***************** Defined in header ```` .. code-block:: cpp template concept byte_type = meta::same_as || (meta::integral && std::numeric_limits::digits + std::numeric_limits::is_signed == std::numeric_limits::digits); The **byte_type** concept is satisfied when one of the following is true: #. **T** is :cpp:`std::byte ` (C++17 and beyond). #. **T** models :ref:`integral` and can represent the same number of bits as ``unsigned char``. ---- Concept emulation ================= .. code-block:: cpp namespace mgs { namespace codecs { template struct is_byte_type { /* ... */ }; template constexpr auto is_byte_type_v = is_byte_type::value; template >> using byte_type = T; } // namespace codecs } // namespace mgs Example ======= .. code-block:: cpp #include #include #include using namespace mgs::codecs; static_assert(is_byte_type_v, ""); static_assert(is_byte_type_v, ""); static_assert(is_byte_type_v, ""); static_assert(!is_byte_type_v, ""); static_assert(!is_byte_type_v, ""); See also ======== * :ref:`same_as` * :ref:`integral`