Metaprogramming Predicate Functions#
- group metapredicates
Hyperion provides an assortment of common metaprogramming predicates to make operations based on them clear and convenient.
Example#
#include <hyperion/mpl/list.h> #include <hyperion/mpl/metapredicates.h> using namespace hyperion::mpl; constexpr auto example1 = List<int, double, float>{}; static_assert(example1.none_of(equal_to(decltype_<usize>()))); constexpr auto example2 = List<Value<1>, Value<2>, Value<3>>{}; static_assert(example2.all_of(less_than(4_value))); constexpr auto example3 = List<std::string, std::string_view>{}; static_assert(example3.all_of(constructible_from(List<const char*, std::size_t>{})));
Exposition-Only Types#
struct as_meta
: Exposition-only template metafunction that converts a type,TType
, to the corresponding metaprogramming type, exposed via the memberusing
aliastype
. MapsTType
in the following manner:If
TType
is aMetaType
, maps toType<typename as_meta<typename TType::type>::type>
, elseIf
TType
is aMetaValue
, maps toValue<TType::value>
, elseIf
TType
is aMetaPair
, maps to, elsePair<typename as_meta<typename TType::first>::type, typename as_meta<typename TType::second>::type>
Maps to
Type<TType>
struct as_raw
: Exposition-only template metafunction that converts a type,TType
, to the corresponding raw type, exposed via the memberusing
aliastype
. MapsTType
in the following manner:If
TType
is aMetaType
, maps totypename as_raw<typename TType::type>::type
, elseIf
TType
is aMetaValue
, maps toValue<TType::value>
, elseIf
TType
is aMetaPair
, maps to, elsePair<typename as_raw<typename TType::first>::type, typename as_raw<typename TType::second>::type>
Maps to
TType
Functions
-
constexpr auto equal_to(auto value) noexcept#
Returns a metaprogramming predicate object used to query whether an argument is equal to
value
.The returned metaprogramming predicate object has call operator equivalent to
constexpr operator()(auto arg) noexcept
, that when invoked, returns whetherarg
is equal tovalue
. Equality is determined, using the exposition-only template metafunctionas_meta
(see the corresponding section in the Metaprogramming List Type module-level documentation), as if by:Ifconstexpr auto arg_as_mpl = typename as_meta<decltype(arg)>::type{}; constexpr auto value_as_mpl = typename as_meta<decltype(value)::type{}; constexpr auto result = arg_as_mpl == value_as_mpl;
arg
andvalue
do not fulfill the same metaprogramming type concept (e.g. ifarg
isMetaValue
butvalue
isMetaType
), always returnsValue<false>
.Requirements#
Example#
constexpr auto example = decltype_<const int&>{}; static_assert(example.satisfies(equal_to(decltype_<const int&>()))); static_assert(not example.satisfies(equal_to(decltype_<float>()))); static_assert(not example.satisfies(equal_to(1_value)));
- Parameters:
value – The value to check for equality with
- Returns:
A metaprogramming predicate object to check that an argument is equal to
value
-
constexpr auto not_equal_to(auto value) noexcept#
Returns a metaprogramming predicate object used to query whether an argument is not equal to
value
.The returned metaprogramming predicate object has call operator equivalent to
constexpr operator()(auto arg) noexcept
, that when invoked, returns whetherarg
is not equal tovalue
. Inequality is determined, using the exposition-only template metafunctionas_meta
(see the corresponding section in the Metaprogramming List Type module-level documentation), as if by:Ifconstexpr auto arg_as_mpl = typename as_meta<decltype(arg)>::type{}; constexpr auto value_as_mpl = typename as_meta<decltype(value)::type{}; constexpr auto result = arg_as_mpl != value_as_mpl;
arg
andvalue
do not fulfill the same metaprogramming type concept (e.g. ifarg
isMetaValue
butvalue
isMetaType
), always returnsValue<true>
.Requirements#
Example#
constexpr auto example = decltype_<const int&>{}; static_assert(not example.satisfies(not_equal_to(decltype_<const int&>()))); static_assert(example.satisfies(not_equal_to(decltype_<float>()))); static_assert(example.satisfies(not_equal_to(1_value)));
- Parameters:
value – The value to check for inequality with
- Returns:
A metaprogramming predicate object to check that an argument is not equal to
value
-
constexpr auto less_than(MetaValue auto value) noexcept#
Returns a metaprogramming predicate object used to query whether an argument is less than
value
.The returned metaprogramming predicate object has call operator equivalent to
constexpr operator()(auto arg) noexcept
, that when invoked, returns whetherarg
is less thanvalue
, determined as if by:constexpr auto arg_as_mpl_value = Value<decltype(arg)::value>{}; constexpr auto value_as_mpl_value = Value<decltype(value)::value>{}; constexpr auto result = arg_as_mpl_value < value_as_mpl_value;
Requirements#
value
must be an instance of aMetaValue
Example#
constexpr auto example = 3_value; static_assert(example.satisfies(less_than(1_value))); static_assert(not example.satisfies(less_than(4_value))); static_assert(not example.satisfies(less_than(5_value)));
- Parameters:
value – The value to check that arguments are less than
- Returns:
A metaprogramming predicate object to check that an argument is less than
value
-
constexpr auto less_than_or_equal_to(MetaValue auto value) noexcept#
Returns a metaprogramming predicate object used to query whether an argument is less than or equal to
value
.The returned metaprogramming predicate object has call operator equivalent to
constexpr operator()(auto arg) noexcept
, that when invoked, returns whetherarg
is less than or equal tovalue
, determined as if by:constexpr auto arg_as_mpl_value = Value<decltype(arg)::value>{}; constexpr auto value_as_mpl_value = Value<decltype(value)::value>{}; constexpr auto result = arg_as_mpl_value <= value_as_mpl_value;
Requirements#
value
must be an instance of aMetaValue
Example#
constexpr auto example = 3_value; static_assert(example.satisfies(less_than_or_equal_to(1_value))); static_assert(example.satisfies(less_than_or_equal_to(3_value))); static_assert(not example.satisfies(less_than_or_equal_to(5_value)));
- Parameters:
value – The value to check that arguments are less than or equal to
- Returns:
A metaprogramming predicate object to check that an argument is less than or equal to
value
-
constexpr auto greater_than(MetaValue auto value) noexcept#
Returns a metaprogramming predicate object used to query whether an argument is greater than
value
.The returned metaprogramming predicate object has call operator equivalent to
constexpr operator()(auto arg) noexcept
, that when invoked, returns whetherarg
is greater thanvalue
, determined as if by:constexpr auto arg_as_mpl_value = Value<decltype(arg)::value>{}; constexpr auto value_as_mpl_value = Value<decltype(value)::value>{}; constexpr auto result = arg_as_mpl_value > value_as_mpl_value;
Requirements#
value
must be an instance of aMetaValue
Example#
constexpr auto example = 3_value; static_assert(example.satisfies(greater_than(1_value))); static_assert(not example.satisfies(greater_than(4_value))); static_assert(not example.satisfies(greater_than(5_value)));
- Parameters:
value – The value to check that arguments are greater than
- Returns:
A metaprogramming predicate object to check that an argument is greater than
value
-
constexpr auto greater_than_or_equal_to(MetaValue auto value) noexcept#
Returns a metaprogramming predicate object used to query whether an argument is greater than or equal to
value
.The returned metaprogramming predicate object has call operator equivalent to
constexpr operator()(auto arg) noexcept
, that when invoked, returns whetherarg
is greater than or equal tovalue
, determined as if by:constexpr auto arg_as_mpl_value = Value<decltype(arg)::value>{}; constexpr auto value_as_mpl_value = Value<decltype(value)::value>{}; constexpr auto result = arg_as_mpl_value >= value_as_mpl_value;
Requirements#
value
must be an instance of aMetaValue
Example#
constexpr auto example = 3_value; static_assert(example.satisfies(greater_than_or_equal_to(1_value))); static_assert(example.satisfies(greater_than_or_equal_to(3_value))); static_assert(not example.satisfies(greater_than_or_equal_to(5_value)));
- Parameters:
value – The value to check that arguments are greater than or equal to
- Returns:
A metaprogramming predicate object to check that an argument is greater than or equal to
value
-
constexpr auto is(MetaType auto type) noexcept#
Returns a metaprogramming predicate object used to query whether a
MetaType
argument represents the same type astype
.The returned metaprogramming predicate object has call operator equivalent to
constexpr operator()(MetaType auto arg) noexcept
, that when invoked, returns whetherarg
represents the same type astype
, determined as if by:constexpr auto arg_as_mpl_type = decltype_(arg); constexpr auto result = as_mpl_type.is(decltype_(type));
Requirements#
type
must be an instance of aMetaType
Example#
constexpr auto example = decltype_<const int&>{}; static_assert(example.satisfies(is(decltype_<const int&>()))); static_assert(not example.satisfies(is(decltype_<int>()))); static_assert(not example.satisfies(is(decltype_<float>())));
- Parameters:
type – The
MetaType
representing the type to check that an argument is- Returns:
A metaprogramming predicate object to check that an argument represents the same type as
typ
Note
This is very similar to
equal_to
, with the sole difference being that this and the returned predicate object are only invocable withMetaType
s, whereasequal_to
is invocable with any type fulfilling a metaprogramming concept’s requirements.
-
constexpr auto qualification_of(MetaType auto type) noexcept#
Returns a metaprogramming predicate object used to query whether a
MetaType
argument represents a type that is a qualification of the type represented bytype
.The returned metaprogramming predicate object has call operator equivalent to
constexpr operator()(MetaType auto arg) noexcept
, that when invoked, returns whetherarg
represents the same type as, or a qualification of, the type represented bytype
, determined as if by:constexpr auto as_mpl_type = decltype_(arg); constexpr auto result = as_mpl_type.is_qualification_of(decltype_(type));
Requirements#
type
must be an instance of aMetaType
Example#
constexpr auto example = decltype_<const int&>{}; static_assert(example.satisfies(qualification_of(decltype_<int>()))); static_assert(not example.satisfies(qualification_of(decltype_<const int&>()))); static_assert(not example.satisfies(qualification_of(decltype_<float>())));
- Parameters:
type – The
MetaType
representing the type to check that an argument is a qualification of- Returns:
A metaprogramming predicate object to check that an argument represents a type that is (possibly) a qualification of the type represented by
type
-
constexpr auto convertible_to(MetaType auto type) noexcept#
Returns a metaprogramming predicate object used to query whether a
MetaType
argument represents a type that is convertible to the type represented bytype
.The returned metaprogramming predicate object has call operator equivalent to
constexpr operator()(MetaType auto arg) noexcept
, that when invoked, returns whetherarg
represents a type convertible to the type represented bytype
, determined as if bydecltype_(element).is_convertible_to(decltype_(type))
.Requirements#
type
must be an instance of aMetaType
Example#
constexpr auto example = decltype_<int>{}; struct example2 {}; static_assert(example.satisfies(convertible_to(decltype_<float>()))); static_assert(not example.satisfies(convertible_to(decltype_<example2>())));
- Parameters:
type – The
MetaType
representing the type to check for convertibility to- Returns:
A metaprogramming predicate object to check that an argument represents a type that is convertible to the type represented by
type
-
constexpr auto derived_from(MetaType auto type) noexcept#
Returns a metaprogramming predicate object used to query whether a
MetaType
argument represents a type that is derived from the type represented bytype
.The returned metaprogramming predicate object has call operator equivalent to
constexpr operator()(MetaType auto arg) noexcept
, that when invoked, returns whetherarg
represents a type derived from the type represented bytype
, determined as if bydecltype_(element).is_derived_from(decltype_(type))
.Requirements#
type
must be an instance of aMetaType
Example#
constexpr auto example = decltype_<int>{}; struct example2 {}; static_assert(example.satisfies(derived_from(decltype_<float>()))); static_assert(not example.satisfies(derived_from(decltype_<example2>())));
- Parameters:
type – The
MetaType
representing the type to check for convertibility to- Returns:
A metaprogramming predicate object to check that an argument represents a type that is derived from the type represented by
type
-
constexpr auto base_of(MetaType auto type) noexcept#
Returns a metaprogramming predicate object used to query whether a
MetaType
argument represents a type that is a base of the type represented bytype
.The returned metaprogramming predicate object has call operator equivalent to
constexpr operator()(MetaType auto arg) noexcept
, that when invoked, returns whetherarg
represents a type that is a base of the type represented bytype
, determined as if bydecltype_(element).is_base_of(decltype_(type))
.Requirements#
type
must be an instance of aMetaType
Example#
constexpr auto example = decltype_<int>{}; struct example2 {}; static_assert(example.satisfies(base_of(decltype_<float>()))); static_assert(not example.satisfies(base_of(decltype_<example2>())));
- Parameters:
type – The
MetaType
representing the type to check for convertibility to- Returns:
A metaprogramming predicate object to check that an argument represents a type that is a base of the type represented by
type
-
constexpr auto constructible_from(MetaType auto... types) noexcept#
Returns a metaprogramming predicate object used to query whether a
MetaType
argument represents a type constructible from a pack of parameters of the types represented bytypes...
.The returned metaprogramming predicate object has call operator equivalent to
constexpr operator()(MetaType auto arg) noexcept
, that when invoked, returns whetherarg
represents a type constructible from the types represented bytypes...
, determined as if bydecltype_(element).is_constructible_from(decltype_(types)...)
.Requirements#
types...
must be instances of aMetaType
s
Example#
struct example_t { example_t(int, float, double); }; constexpr auto example = decltype_<example_t>{}; static_assert(example.satisfies(constructible_from(decltype_<int>(), decltype_<float>(), decltype_<double>()))); static_assert(not example.satisfies(constructible_from(decltype_<float>())));
- Parameters:
types – The
MetaType
representing the types of the argument pack to check for constructibility from- Returns:
A metaprogramming predicate object to check that an argument represents a type that is constructible from an argument pack of the types represented by
types...
-
template<template<typename...> typename TList, typename ...TTypes>
constexpr auto constructible_from(TList<TTypes...> types) noexcept# Returns a metaprogramming predicate object used to query whether a
MetaType
argument represents a type constructible from a pack of parameters of the typesTTypes...
.The returned metaprogramming predicate object has call operator equivalent to
constexpr operator()(MetaType auto arg) noexcept
, that when invoked, returns whetherarg
represents a type constructible from the raw types represented byTTypes...
. That is, if any typetype
ofTTypes...
is aMetaType
, the check will use the wrapped type oftype
,typename type::type
(this guarantee is provided bympl::Type::is_constructible_from
). The constructibility is determined as if bydecltype_(element).is_constructible_from(types)
.Requirements#
types
must not be aMetaType
Example#
struct example_t { example_t(int, float, double); }; constexpr auto example = decltype_<example_t>{}; static_assert(example.satisfies(constructible_from(List<int, float, double>{}))); static_assert(not example.satisfies(constructible_from(List<float>{})));
- Template Parameters:
TList – The metaprogramming list type representing the types of the arguments to check constructibility with
TTypes – The types of the arguments to check constructibility with
- Parameters:
types – The metaprogramming list representing the types of the arguments to check constructibility with
- Returns:
A metaprogramming predicate object to check that an argument represents a type that is constructible from an argument pack of the types represented by
types
-
constexpr auto noexcept_constructible_from(MetaType auto... types) noexcept#
Returns a metaprogramming predicate object used to query whether a
MetaType
argument represents a typenoexcept
constructible from a pack of parameters of the types represented bytypes...
.The returned metaprogramming predicate object has call operator equivalent to
constexpr operator()(MetaType auto arg) noexcept
, that when invoked, returns whetherarg
represents a typenoexcept
constructible from the types represented bytypes...
, determined as if bydecltype_(element).is_noexcept_constructible_from(decltype_(types)...)
.Requirements#
types...
must be instances of aMetaType
s
Example#
struct example_t { example_t(int, float, double) noexcept; example_t(float, int); }; constexpr auto example = decltype_<example_t>{}; static_assert(example.satisfies(noexcept_constructible_from(decltype_<int>(), decltype_<float>(), decltype_<double>()))); static_assert(not example.satisfies(noexcept_constructible_from(decltype_<float>()))); static_assert(not example.satisfies(noexcept_constructible_from(decltype_<float>(), decltype_<int>()))));
- Parameters:
types – The
MetaType
representing the types of the argument pack to check fornoexcept
constructibility from- Returns:
A metaprogramming predicate object to check that an argument represents a type that is
noexcept
constructible from an argument pack of the types represented bytypes...
-
template<template<typename...> typename TList, typename ...TTypes>
constexpr auto noexcept_constructible_from(TList<TTypes...> types) noexcept# Returns a metaprogramming predicate object used to query whether a
MetaType
argument represents a typenoexcept
constructible from a pack of parameters of the typesTTypes...
.The returned metaprogramming predicate object has call operator equivalent to
constexpr operator()(MetaType auto arg) noexcept
, that when invoked, returns whetherarg
represents a typenoexcept
constructible from the raw types represented byTTypes...
. That is, if any typetype
ofTTypes...
is aMetaType
, the check will use the wrapped type oftype
,typename type::type
(this guarantee is provided bympl::Type::is_constructible_from
). The constructibility is determined as if bydecltype_(element).is_noexcept_constructible_from(types)
.Requirements#
types
must not be aMetaType
Example#
struct example_t { example_t(int, float, double) noexcept; example_t(float, int); }; constexpr auto example = decltype_<example_t>{}; static_assert(example.satisfies(noexcept_constructible_from(List<int, float, double>{}))); static_assert(not example.satisfies(noexcept_constructible_from(List<float>{}))); static_assert(not example.satisfies(noexcept_constructible_from(List<float, int>{}))));
- Template Parameters:
TList – The metaprogramming list type representing the types of the arguments to check
noexcept
constructibility withTTypes – The types of the arguments to check
noexcept
constructibility with
- Parameters:
types – The metaprogramming list representing the types of the arguments to check
noexcept
constructibility with- Returns:
A metaprogramming predicate object to check that an argument represents a type that is
noexcept
constructible from an argument pack of the types represented bytypes
-
constexpr auto swappable_with(MetaType auto type) noexcept#
Returns a metaprogramming predicate object used to query whether a
MetaType
argument represents a type that is swappable with the type represented bytype
.A type,
type1
, is swappable with another type,type2
, if , givenlhs
andrhs
that aretype1&
andtype2&
, respectively,std::swap(lhs, rhs)
andstd::swap(rhs, lhs)
are both well-formed.The returned metaprogramming predicate object has call operator equivalent to
constexpr operator()(MetaType auto arg) noexcept
, that when invoked, returns whetherarg
represents a type swappable with the type represented bytype
, determined as if bydecltype_(element).is_swappable_with(decltype_(type))
.Requirements#
type
must be an instance of aMetaType
Example#
struct example_t { friend void swap(example_t&, example_t&); friend void swap(example_t&, int&); friend void swap(int&, example_t&); }; struct example2_t { friend void swap(example2_t&, int&) = delete; }; static_assert(example_t.satisfies(swappable_with(decltype_<int>()))); static_assert(example_t.satisfies(swappable_with(decltype_<example_t>()))); static_assert(not example2_t.satisfies(swappable_with(decltype_<int>())));
- Parameters:
type – The
MetaType
representing the type to check for swappability with- Returns:
A metaprogramming predicate object used to check that an argument represents a type that is swappable with the type represented by
type
-
constexpr auto noexcept_swappable_with(MetaType auto type) noexcept#
Returns a metaprogramming predicate object used to query whether a
MetaType
argument represents a type that isnoexcept
swappable with the type represented bytype
.A type,
type1
, isnoexcept
swappable with another type,type2
, if , givenlhs
andrhs
that aretype1&
andtype2&
, respectively,std::swap(lhs, rhs)
andstd::swap(rhs, lhs)
are both well-formed andnoexcept
.The returned metaprogramming predicate object has call operator equivalent to
constexpr operator()(MetaType auto arg) noexcept
, that when invoked, returns whetherarg
represents a typenoexcept
swappable with the type represented bytype
, determined as if bydecltype_(element).is_noexcept_swappable_with(decltype_(type))
.Requirements#
type
must be an instance of aMetaType
Example#
struct example_t { friend void swap(example_t&, example_t&) noexcept(false); friend void swap(example_t&, int&) noexcept; friend void swap(int&, example_t&) noexcept; }; struct example2_t { friend void swap(example2_t&, int&) = delete; }; static_assert(example_t.satisfies(noexcept_swappable_with(decltype_<int>()))); static_assert(not example_t.satisfies(noexcept_swappable_with(decltype_<example_t>()))); static_assert(not example2_t.satisfies(noexcept_swappable_with(decltype_<int>())));
- Parameters:
type – The
MetaType
representing the type to check fornoexcept
swappability with- Returns:
A metaprogramming predicate object used to check that an argument represents a type that is
noexcept
swappable with the type represented bytype
Variables
-
constexpr auto is_const =
[](MetaType auto type) noexcept {return decltype_(type).is_const();}
# Metaprogramming predicate object used to query whether a
MetaType
argument represents a type that isconst
qualified.Determines whether the represented type is
const
as if bydecltype_(type).is_const()
.Requirements#
type
must be an instance of aMetaType
Example#
constexpr auto example1 = decltype_<const int&>{}; constexpr auto example2 = decltype_<const int>{}; constexpr auto example3 = decltype_<int>{}; static_assert(example1.satisfies(is_const)); static_assert(example2.satisfies(is_const)); static_assert(not example3.satisfies(is_const));
- Param type:
The
MetaType
representing the type to check that isconst
- Return:
whether the type represented by
type
isconst
-
constexpr auto is_lvalue_reference =
[](MetaType auto type) noexcept {return decltype_(type).is_lvalue_reference();}
# Metaprogramming predicate object used to query whether a
MetaType
argument represents a type that is lvalue-reference qualified.Determines whether the represented type is lvalue-reference qualified as if by
decltype_(type).is_lvalue_reference()
.Requirements#
type
must be an instance of aMetaType
Example#
constexpr auto example1 = decltype_<const int&>{}; constexpr auto example2 = decltype_<const int>{}; constexpr auto example3 = decltype_<int>{}; static_assert(example1.satisfies(is_lvalue_reference)); static_assert(not example2.satisfies(is_lvalue_reference)); static_assert(not example3.satisfies(is_lvalue_reference));
- Param type:
The
MetaType
representing the type to check that is an lvalue-reference- Return:
whether the type represented by
type
is an lvalue-reference
-
constexpr auto is_rvalue_reference =
[](MetaType auto type) noexcept {return decltype_(type).is_rvalue_reference();}
# Metaprogramming predicate object used to query whether a
MetaType
argument represents a type that is rvalue-reference qualified.Determines whether the represented type is rvalue-reference qualified as if by
decltype_(type).is_rvalue_reference()
.Requirements#
type
must be an instance of aMetaType
Example#
constexpr auto example1 = decltype_<const int&&>{}; constexpr auto example2 = decltype_<const int>{}; constexpr auto example3 = decltype_<int>{}; static_assert(example1.satisfies(is_rvalue_reference)); static_assert(not example2.satisfies(is_rvalue_reference)); static_assert(not example3.satisfies(is_rvalue_reference));
- Param type:
The
MetaType
representing the type to check that is an rvalue-reference- Return:
whether the type represented by
type
is an rvalue-reference
-
constexpr auto is_volatile =
[](MetaType auto type) noexcept {return decltype_(type).is_volatile();}
# Metaprogramming predicate object used to query whether a
MetaType
argument represents a type that isvolatile
qualified.Determines whether the represented type is
volatile
as if bydecltype_(type).is_volatile()
.Requirements#
type
must be an instance of aMetaType
Example#
constexpr auto example1 = decltype_<volatile int&>{}; constexpr auto example2 = decltype_<volatile int>{}; constexpr auto example3 = decltype_<int>{}; static_assert(example1.satisfies(is_volatile)); static_assert(example2.satisfies(is_volatile)); static_assert(not example3.satisfies(is_volatile));
- Param type:
The
MetaType
representing the type to check that isvolatile
- Return:
whether the type represented by
type
isvolatile
-
constexpr auto default_constructible =
[](MetaType auto type) noexcept {return decltype_(type).is_default_constructible();}
# Metaprogramming predicate object used to query whether a
MetaType
argument represents a type that is default constructible.Determines whether the represented type is default constructible, as if by
decltype_(type).is_default_constructible()
.Requirements#
type
must be an instance of aMetaType
Example#
struct example_t {}; struct example3_t { example3_t() = delete; }; constexpr auto example1 = decltype_<example_t>{}; constexpr auto example2 = decltype_<int>{}; constexpr auto example3 = decltype_<example3_t>{}; static_assert(example1.satisfies(default_constructible)); static_assert(example2.satisfies(default_constructible)); static_assert(not example3.satisfies(default_constructible));
- Param type:
The
MetaType
representing the type to check that is default constructible- Return:
whether the type represented by
type
is default constructible
-
constexpr auto noexcept_default_constructible =
[](MetaType auto type) noexcept {return decltype_(type).is_noexcept_default_constructible();}
# Metaprogramming predicate object used to query whether a
MetaType
argument represents a type that isnoexcept
default constructible.Determines whether the represented type is
noexcept
default constructible, as if bydecltype_(type).is_noexcept_default_constructible()
.Requirements#
type
must be an instance of aMetaType
Example#
struct example_t { example_t() noexcept; }; struct example2_t { example2_t() noexcept(false); } struct example3_t { example3_t() = delete; }; constexpr auto example1 = decltype_<example_t>{}; constexpr auto example2 = decltype_<example2_t>{}; constexpr auto example3 = decltype_<example3_t>{}; static_assert(example1.satisfies(noexcept_default_constructible)); static_assert(not example2.satisfies(noexcept_default_constructible)); static_assert(not example3.satisfies(noexcept_default_constructible));
- Param type:
The
MetaType
representing the type to check that isnoexcept
default constructible- Return:
whether the type represented by
type
isnoexcept
default constructible
-
constexpr auto trivially_default_constructible =
[](MetaType auto type) noexcept {return decltype_(type).is_trivially_default_constructible();}
# Metaprogramming predicate object used to query whether a
MetaType
argument represents a type that is trivially default constructible.Determines whether the represented type is trivially default constructible as if by
decltype_(type).is_trivially_default_constructible()
.Requirements#
type
must be an instance of aMetaType
Example#
struct example_t { }; struct example2_t { example2_t(); }; struct example3_t { example3_t() = delete; }; constexpr auto example1 = decltype_<example_t>{}; constexpr auto example2 = decltype_<example2_t>{}; constexpr auto example3 = decltype_<example3_t>{}; static_assert(example1.satisfies(trivially_default_constructible)); static_assert(not example2.satisfies(trivially_default_constructible)); static_assert(not example3.satisfies(trivially_default_constructible));
- Param type:
The
MetaType
representing the type to check that is trivially default constructible- Return:
whether the type represented by
type
is trivially default constructible
-
constexpr auto copy_constructible =
[](MetaType auto type) noexcept {return decltype_(type).is_copy_constructible();}
# Metaprogramming predicate object used to query whether a
MetaType
argument represents a type that is copy constructible.Determines whether the represented type is copy constructible, as if by
decltype_(type).is_copy_constructible()
.Requirements#
type
must be an instance of aMetaType
Example#
struct example_t {}; struct example3_t { example3_t(const example3_t&) = delete; }; constexpr auto example1 = decltype_<example_t>{}; constexpr auto example2 = decltype_<int>{}; constexpr auto example3 = decltype_<example3_t>{}; static_assert(example1.satisfies(copy_constructible)); static_assert(example2.satisfies(copy_constructible)); static_assert(not example3.satisfies(copy_constructible));
- Param type:
The
MetaType
representing the type to check that is copy constructible- Return:
whether the type represented by
type
is copy constructible
-
constexpr auto noexcept_copy_constructible =
[](MetaType auto type) noexcept {return decltype_(type).is_noexcept_copy_constructible();}
# Metaprogramming predicate object used to query whether a
MetaType
argument represents a type that isnoexcept
copy constructible.Determines whether the represented type is
noexcept
copy constructible, as if bydecltype_(type).is_noexcept_copy_constructible()
.Requirements#
type
must be an instance of aMetaType
Example#
struct example_t { example_t(const example_t&) noexcept; }; struct example2_t { example2_t(const example2_t&) noexcept(false); } struct example3_t { example3_t(const example3_t&) = delete; }; constexpr auto example1 = decltype_<example_t>{}; constexpr auto example2 = decltype_<example2_t>{}; constexpr auto example3 = decltype_<example3_t>{}; static_assert(example1.satisfies(noexcept_copy_constructible)); static_assert(not example2.satisfies(noexcept_copy_constructible)); static_assert(not example3.satisfies(noexcept_copy_constructible));
- Param type:
The
MetaType
representing the type to check that isnoexcept
copy constructible- Return:
whether the type represented by
type
isnoexcept
copy constructible
-
constexpr auto trivially_copy_constructible =
[](MetaType auto type) noexcept {return decltype_(type).is_trivially_copy_constructible();}
# Metaprogramming predicate object used to query whether a
MetaType
argument represents a type that is trivially copy constructible.Determines whether the represented type is trivially copy constructible as if by
decltype_(type).is_trivially_copy_constructible()
.Requirements#
type
must be an instance of aMetaType
Example#
struct example_t { }; struct example2_t { example2_t(const example2_t&); }; struct example3_t { example3_t(const example3_t&) = delete; }; constexpr auto example1 = decltype_<example_t>{}; constexpr auto example2 = decltype_<example2_t>{}; constexpr auto example3 = decltype_<example3_t>{}; static_assert(example1.satisfies(trivially_copy_constructible)); static_assert(not example2.satisfies(trivially_copy_constructible)); static_assert(not example3.satisfies(trivially_copy_constructible));
- Param type:
The
MetaType
representing the type to check that is trivially copy constructible- Return:
whether the type represented by
type
is trivially copy constructible
-
constexpr auto move_constructible =
[](MetaType auto type) noexcept {return decltype_(type).is_move_constructible();}
# Metaprogramming predicate object used to query whether a
MetaType
argument represents a type that is move constructible.Determines whether the represented type is move constructible, as if by
decltype_(type).is_move_constructible()
.Requirements#
type
must be an instance of aMetaType
Example#
struct example_t {}; struct example3_t { example3_t(example3_t&&) = delete; }; constexpr auto example1 = decltype_<example_t>{}; constexpr auto example2 = decltype_<int>{}; constexpr auto example3 = decltype_<example3_t>{}; static_assert(example1.satisfies(move_constructible)); static_assert(example2.satisfies(move_constructible)); static_assert(not example3.satisfies(move_constructible));
- Param type:
The
MetaType
representing the type to check that is move constructible- Return:
whether the type represented by
type
is move constructible
-
constexpr auto noexcept_move_constructible =
[](MetaType auto type) noexcept {return decltype_(type).is_noexcept_move_constructible();}
# Metaprogramming predicate object used to query whether a
MetaType
argument represents a type that isnoexcept
move constructible.Determines whether the represented type is
noexcept
move constructible, as if bydecltype_(type).is_noexcept_move_constructible()
.Requirements#
type
must be an instance of aMetaType
Example#
struct example_t { example_t(example_t&&) noexcept; }; struct example2_t { example2_t(example2_t&&) noexcept(false); } struct example3_t { example3_t(example3_t&&) = delete; }; constexpr auto example1 = decltype_<example_t>{}; constexpr auto example2 = decltype_<example2_t>{}; constexpr auto example3 = decltype_<example3_t>{}; static_assert(example1.satisfies(noexcept_move_constructible)); static_assert(not example2.satisfies(noexcept_move_constructible)); static_assert(not example3.satisfies(noexcept_move_constructible));
- Param type:
The
MetaType
representing the type to check that isnoexcept
move constructible- Return:
whether the type represented by
type
isnoexcept
move constructible
-
constexpr auto trivially_move_constructible =
[](MetaType auto type) noexcept {return decltype_(type).is_trivially_move_constructible();}
# Metaprogramming predicate object used to query whether a
MetaType
argument represents a type that is trivially move constructible.Determines whether the represented type is trivially move constructible as if by
decltype_(type).is_trivially_move_constructible()
.Requirements#
type
must be an instance of aMetaType
Example#
struct example_t { }; struct example2_t { example2_t(example2_t&&); }; struct example3_t { example3_t(example3_t&&) = delete; }; constexpr auto example1 = decltype_<example_t>{}; constexpr auto example2 = decltype_<example2_t>{}; constexpr auto example3 = decltype_<example3_t>{}; static_assert(example1.satisfies(trivially_move_constructible)); static_assert(not example2.satisfies(trivially_move_constructible)); static_assert(not example3.satisfies(trivially_move_constructible));
- Param type:
The
MetaType
representing the type to check that is trivially move constructible- Return:
whether the type represented by
type
is trivially move constructible
-
constexpr auto copy_assignable =
[](MetaType auto type) noexcept {return decltype_(type).is_copy_assignable();}
# Metaprogramming predicate object used to query whether a
MetaType
argument represents a type that is copy assignable.Determines whether the represented type is copy assignable, as if by
decltype_(type).is_copy_assignable()
.Requirements#
type
must be an instance of aMetaType
Example#
struct example_t {}; struct example3_t { auto operator=(const example3_t&) -> example3_t& = delete; }; constexpr auto example1 = decltype_<example_t>{}; constexpr auto example2 = decltype_<int>{}; constexpr auto example3 = decltype_<example3_t>{}; static_assert(example1.satisfies(copy_assignable)); static_assert(example2.satisfies(copy_assignable)); static_assert(not example3.satisfies(copy_assignable));
- Param type:
The
MetaType
representing the type to check that is copy assignable- Return:
whether the type represented by
type
is copy assignable
-
constexpr auto noexcept_copy_assignable =
[](MetaType auto type) noexcept {return decltype_(type).is_noexcept_copy_assignable();}
# Metaprogramming predicate object used to query whether a
MetaType
argument represents a type that isnoexcept
copy assignable.Determines whether the represented type is
noexcept
copy assignable, as if bydecltype_(type).is_noexcept_copy_assignable()
.Requirements#
type
must be an instance of aMetaType
Example#
struct example_t { auto operator=(const example_t&) noexcept -> example_t&; }; struct example2_t { auto operator=(const example2_t&) noexcept(false) -> example2_t&; } struct example3_t { auto operator=(const example3_t&) -> example3_t& = delete; }; constexpr auto example1 = decltype_<example_t>{}; constexpr auto example2 = decltype_<example2_t>{}; constexpr auto example3 = decltype_<example3_t>{}; static_assert(example1.satisfies(noexcept_copy_assignable)); static_assert(not example2.satisfies(noexcept_copy_assignable)); static_assert(not example3.satisfies(noexcept_copy_assignable));
- Param type:
The
MetaType
representing the type to check that isnoexcept
copy assignable- Return:
whether the type represented by
type
isnoexcept
copy assignable
-
constexpr auto trivially_copy_assignable =
[](MetaType auto type) noexcept {return decltype_(type).is_trivially_copy_assignable();}
# Metaprogramming predicate object used to query whether a
MetaType
argument represents a type that is trivially copy assignable.Determines whether the represented type is trivially copy assignable as if by
decltype_(type).is_trivially_copy_assignable()
.Requirements#
type
must be an instance of aMetaType
Example#
struct example_t { }; struct example2_t { auto operator=(const example2_t&) -> example2_t&; }; struct example3_t { auto operator=(const example3_t&) -> example3_t& = delete; }; constexpr auto example1 = decltype_<example_t>{}; constexpr auto example2 = decltype_<example2_t>{}; constexpr auto example3 = decltype_<example3_t>{}; static_assert(example1.satisfies(trivially_copy_assignable)); static_assert(not example2.satisfies(trivially_copy_assignable)); static_assert(not example3.satisfies(trivially_copy_assignable));
- Param type:
The
MetaType
representing the type to check that is trivially copy assignable- Return:
whether the type represented by
type
is trivially copy assignable
-
constexpr auto move_assignable =
[](MetaType auto type) noexcept {return decltype_(type).is_move_assignable();}
# Metaprogramming predicate object used to query whether a
MetaType
argument represents a type that is move assignable.Determines whether the represented type is move assignable, as if by
decltype_(type).is_move_assignable()
.Requirements#
type
must be an instance of aMetaType
Example#
struct example_t {}; struct example3_t { auto operator=(example3_t&&) -> example3_t& = delete; }; constexpr auto example1 = decltype_<example_t>{}; constexpr auto example2 = decltype_<int>{}; constexpr auto example3 = decltype_<example3_t>{}; static_assert(example1.satisfies(move_assignable)); static_assert(example2.satisfies(move_assignable)); static_assert(not example3.satisfies(move_assignable));
- Param type:
The
MetaType
representing the type to check that is move assignable- Return:
whether the type represented by
type
is move assignable
-
constexpr auto noexcept_move_assignable =
[](MetaType auto type) noexcept {return decltype_(type).is_noexcept_move_assignable();}
# Metaprogramming predicate object used to query whether a
MetaType
argument represents a type that isnoexcept
move assignable.Determines whether the represented type is
noexcept
move assignable, as if bydecltype_(type).is_noexcept_move_assignable()
.Requirements#
type
must be an instance of aMetaType
Example#
struct example_t { auto operator=(example_t&&) noexcept -> example_t&; }; struct example2_t { auto operator=(example2_t&&) noexcept(false) -> example2_t&; } struct example3_t { auto operator=(example3_t&&) -> example3_t& = delete; }; constexpr auto example1 = decltype_<example_t>{}; constexpr auto example2 = decltype_<example2_t>{}; constexpr auto example3 = decltype_<example3_t>{}; static_assert(example1.satisfies(noexcept_move_assignable)); static_assert(not example2.satisfies(noexcept_move_assignable)); static_assert(not example3.satisfies(noexcept_move_assignable));
- Param type:
The
MetaType
representing the type to check that isnoexcept
move assignable- Return:
whether the type represented by
type
isnoexcept
move assignable
-
constexpr auto trivially_move_assignable =
[](MetaType auto type) noexcept {return decltype_(type).is_trivially_move_assignable();}
# Metaprogramming predicate object used to query whether a
MetaType
argument represents a type that is trivially move assignable.Determines whether the represented type is trivially move assignable as if by
decltype_(type).is_trivially_move_assignable()
.Requirements#
type
must be an instance of aMetaType
Example#
struct example_t { }; struct example2_t { auto operator=(example2_t&&) -> example2_t&; }; struct example3_t { auto operator=(example3_t&&) -> example3_t& = delete; }; constexpr auto example1 = decltype_<example_t>{}; constexpr auto example2 = decltype_<example2_t>{}; constexpr auto example3 = decltype_<example3_t>{}; static_assert(example1.satisfies(trivially_move_assignable)); static_assert(not example2.satisfies(trivially_move_assignable)); static_assert(not example3.satisfies(trivially_move_assignable));
- Param type:
The
MetaType
representing the type to check that is trivially move assignable- Return:
whether the type represented by
type
is trivially move assignable
-
constexpr auto destructible =
[](MetaType auto type) noexcept {return decltype_(type).is_destructible();}
# Metaprogramming predicate object used to query whether a
MetaType
argument represents a type that is destructible.Determines whether the represented type is destructible, as if by
decltype_(type).is_destructible()
.Requirements#
type
must be an instance of aMetaType
Example#
struct example_t {}; struct example3_t { ~example3_t() = delete; }; constexpr auto example1 = decltype_<example_t>{}; constexpr auto example2 = decltype_<int>{}; constexpr auto example3 = decltype_<example3_t>{}; static_assert(example1.satisfies(destructible)); static_assert(example2.satisfies(destructible)); static_assert(not example3.satisfies(destructible));
- Param type:
The
MetaType
representing the type to check that is destructible- Return:
whether the type represented by
type
is destructible
-
constexpr auto noexcept_destructible =
[](MetaType auto type) noexcept {return decltype_(type).is_noexcept_destructible();}
# Metaprogramming predicate object used to query whether a
MetaType
argument represents a type that isnoexcept
destructible.Determines whether the represented type is
noexcept
destructible, as if bydecltype_(type).is_noexcept_destructible()
.Requirements#
type
must be an instance of aMetaType
Example#
struct example_t { ~example_t() noexcept; }; struct example2_t { ~example2_t() noexcept(false); } struct example3_t { ~example3_t() = delete; }; constexpr auto example1 = decltype_<example_t>{}; constexpr auto example2 = decltype_<example2_t>{}; constexpr auto example3 = decltype_<example3_t>{}; static_assert(example1.satisfies(noexcept_destructible)); static_assert(not example2.satisfies(noexcept_destructible)); static_assert(not example3.satisfies(noexcept_destructible));
- Param type:
The
MetaType
representing the type to check that isnoexcept
destructible- Return:
whether the type represented by
type
isnoexcept
destructible
-
constexpr auto trivially_destructible =
[](MetaType auto type) noexcept {return decltype_(type).is_trivially_destructible();}
# Metaprogramming predicate object used to query whether a
MetaType
argument represents a type that is trivially destructible.Determines whether the represented type is trivially destructible as if by
decltype_(type).is_trivially_destructible()
.Requirements#
type
must be an instance of aMetaType
Example#
struct example_t { }; struct example2_t { ~example2_t(); }; struct example3_t { ~example3_t() = delete; }; constexpr auto example1 = decltype_<example_t>{}; constexpr auto example2 = decltype_<example2_t>{}; constexpr auto example3 = decltype_<example3_t>{}; static_assert(example1.satisfies(trivially_destructible)); static_assert(not example2.satisfies(trivially_destructible)); static_assert(not example3.satisfies(trivially_destructible));
- Param type:
The
MetaType
representing the type to check that is trivially destructible- Return:
whether the type represented by
type
is trivially destructible
-
constexpr auto swappable =
[](MetaType auto type) noexcept {return decltype_(type).is_swappable();}
# Metaprogramming predicate object used to query whether a
MetaType
argument represents a type that is swappable.A type,
type
is swappable if , givenlhs
andrhs
that are bothtype&
,std::swap(lhs, rhs)
is well-formed.Determines whether the represented type is swappable as if by
decltype_(type).is_swappable()
.Requirements#
type
must be an instance of aMetaType
Example#
struct example_t { friend void swap(example_t&, example_t&); }; struct example2_t { friend void swap(example2_t&, example2_t&) = delete; }; static_assert(example_t.satisfies(swappable)); static_assert(not example2_t.satisfies(swappable));
- Param type:
The
MetaType
representing the type to check for swappability- Return:
whether the type represented by
type
is swappable
-
constexpr auto noexcept_swappable =
[](MetaType auto type) noexcept {return decltype_(type).is_noexcept_swappable();}
# Metaprogramming predicate object used to query whether a
MetaType
argument represents a type that isnoexcept
swappable.A type,
type
isnoexcept
swappable if , givenlhs
andrhs
that are bothtype&
,std::swap(lhs, rhs)
is well-formed andnoexcept
.Determines whether the represented type is
noexcept
swappable as if bydecltype_(type).is_noexcept_swappable()
.Requirements#
type
must be an instance of aMetaType
Example#
struct example_t { friend void swap(example_t&, example_t&) noexcept; }; struct example2_t { friend void swap(example2_t&, example2_t&) noexcept(false); }; struct example3_t { friend void swap(example3_t&, example3_t&) = delete; }; static_assert(example_t.satisfies(swappable)); static_assert(not example2_t.satisfies(swappable)); static_assert(not example3_t.satisfies(swappable));
- Param type:
The
MetaType
representing the type to check fornoexcept
swappability- Return:
whether the type represented by
type
isnoexcept
swappable