Standard Supplemental Type Traits#
- group std_supplemental_traits
Assortment of type traits to supplement those provided by the standard. These are generally either similar to existing traits, but implemented more or less stringently to account for use-cases in which the standard implementations are incompatible, or completely novel traits, filling in gaps in the API surface that the standard doesn’t cover.
Example:#
#include <hyperion/mpl/type_traits/std_supplemental.h> using namespace hyperion::mpl::type_traits; struct trivially_move_but_not_copyable { trivially_move_but_not_copyable(const trivially_move_but_not_copyable&) = delete; trivially_move_but_not_copyable(trivially_move_but_not_copyable&&) = default; auto operator=(const trivially_move_but_not_copyable&) -> trivially_move_but_not_copyable& = delete; auto operator=(trivially_move_but_not_copyable&&) -> trivially_move_but_not_copyable& = default; }; static_assert(is_trivially_movable_v<trivially_move_but_not_copyable>); static_assert(!is_trivially_movable_v<std::vector<int>>);
Variables
-
template<typename TType>
static constexpr auto is_trivially_movable_v = is_trivially_movable<TType>::value# Value of the type trait
is_trivially_movable
. Requires that the typeTType
is trivially movable. A type that is trivially movable is both trivially move constructible and trivially move assignable.For a type to be trivially move constructible, the type must be move constructible, and its move constructor must either not be user provided in any way, or explicitly defaulted by declaring it as
= default
. Similarly, for a type to be trivially move assignable, the type must be move assignable, and its move assignment operator must either not be user provided in any way, or explicitly defaulted by declaring it as= default
.- Template Parameters:
TType – The type to check
-
template<typename TType>
struct is_trivially_movable : public std::bool_constant<std::is_trivially_move_constructible_v<TType> && std::is_trivially_move_assignable_v<TType>># - #include <hyperion/mpl/type_traits/std_supplemental.h>
Type trait requiring that the type
TType
is trivially movable. A type that is trivially movable is both trivially move constructible and trivially move assignable.For a type to be trivially move constructible, the type must be move constructible, and its move constructor must either not be user provided in any way, or explicitly defaulted by declaring it as
= default
. Similarly, for a type to be trivially move assignable, the type must be move assignable, and its move assignment operator must either not be user provided in any way, or explicitly defaulted by declaring it as= default
.- Template Parameters:
TType – The type to check
-
template<typename TType>