Metaprogramming Predicate Functions#
- group Common Metaprogramming Predicate definitions
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 memberusingaliastype. MapsTTypein the following manner:If
TTypeis aMetaType, maps toType<typename as_meta<typename TType::type>::type>, elseIf
TTypeis aMetaValue, maps toValue<TType::value>, elseIf
TTypeis 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 memberusingaliastype. MapsTTypein the following manner:If
TTypeis aMetaType, maps totypename as_raw<typename TType::type>::type, elseIf
TTypeis aMetaValue, maps toValue<TType::value>, elseIf
TTypeis aMetaPair, maps to, elsePair<typename as_raw<typename TType::first>::type, typename as_raw<typename TType::second>::type>
Maps to
TType
Functions
-
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 whetherargis 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;
argandvaluedo not fulfill the same metaprogramming type concept (e.g. ifargisMetaValuebutvalueisMetaType), 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
-
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 whetherargis 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;
argandvaluedo not fulfill the same metaprogramming type concept (e.g. ifargisMetaValuebutvalueisMetaType), 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
-
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 whetherargis 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#
valuemust 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
-
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 whetherargis 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#
valuemust 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
-
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 whetherargis 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#
valuemust 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
-
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 whetherargis 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#
valuemust 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
-
auto is(MetaType auto type) noexcept#
Returns a metaprogramming predicate object used to query whether a
MetaTypeargument 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 whetherargrepresents 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#
typemust 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
MetaTyperepresenting 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 withMetaTypes, whereasequal_tois invocable with any type fulfilling a metaprogramming concept’s requirements.
-
auto qualification_of(MetaType auto type) noexcept#
Returns a metaprogramming predicate object used to query whether a
MetaTypeargument 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 whetherargrepresents 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#
typemust 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
MetaTyperepresenting 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
-
auto convertible_to(MetaType auto type) noexcept#
Returns a metaprogramming predicate object used to query whether a
MetaTypeargument 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 whetherargrepresents a type convertible to the type represented bytype, determined as if bydecltype_(element).is_convertible_to(decltype_(type)).Requirements#
typemust 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
MetaTyperepresenting 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
-
auto derived_from(MetaType auto type) noexcept#
Returns a metaprogramming predicate object used to query whether a
MetaTypeargument 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 whetherargrepresents a type derived from the type represented bytype, determined as if bydecltype_(element).is_derived_from(decltype_(type)).Requirements#
typemust 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
MetaTyperepresenting 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
-
auto base_of(MetaType auto type) noexcept#
Returns a metaprogramming predicate object used to query whether a
MetaTypeargument 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 whetherargrepresents a type that is a base of the type represented bytype, determined as if bydecltype_(element).is_base_of(decltype_(type)).Requirements#
typemust 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
MetaTyperepresenting 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
-
auto constructible_from(MetaType auto... types) noexcept#
Returns a metaprogramming predicate object used to query whether a
MetaTypeargument 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 whetherargrepresents a type constructible from the types represented bytypes..., determined as if bydecltype_(element).is_constructible_from(decltype_(types)...).Requirements#
types...must be instances of aMetaTypes
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
MetaTyperepresenting 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>
auto constructible_from(TList<TTypes...> types) noexcept# Returns a metaprogramming predicate object used to query whether a
MetaTypeargument 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 whetherargrepresents a type constructible from the raw types represented byTTypes.... That is, if any typetypeofTTypes...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#
typesmust 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
-
auto noexcept_constructible_from(MetaType auto... types) noexcept#
Returns a metaprogramming predicate object used to query whether a
MetaTypeargument represents a typenoexceptconstructible 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 whetherargrepresents a typenoexceptconstructible from the types represented bytypes..., determined as if bydecltype_(element).is_noexcept_constructible_from(decltype_(types)...).Requirements#
types...must be instances of aMetaTypes
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
MetaTyperepresenting the types of the argument pack to check fornoexceptconstructibility from- Returns:
A metaprogramming predicate object to check that an argument represents a type that is
noexceptconstructible from an argument pack of the types represented bytypes...
-
template<template<typename...> typename TList, typename ...TTypes>
auto noexcept_constructible_from(TList<TTypes...> types) noexcept# Returns a metaprogramming predicate object used to query whether a
MetaTypeargument represents a typenoexceptconstructible 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 whetherargrepresents a typenoexceptconstructible from the raw types represented byTTypes.... That is, if any typetypeofTTypes...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#
typesmust 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
noexceptconstructibility withTTypes – The types of the arguments to check
noexceptconstructibility with
- Parameters:
types – The metaprogramming list representing the types of the arguments to check
noexceptconstructibility with- Returns:
A metaprogramming predicate object to check that an argument represents a type that is
noexceptconstructible from an argument pack of the types represented bytypes
-
auto swappable_with(MetaType auto type) noexcept#
Returns a metaprogramming predicate object used to query whether a
MetaTypeargument represents a type that is swappable with the type represented bytype.A type,
type1, is swappable with another type,type2, if , givenlhsandrhsthat 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 whetherargrepresents a type swappable with the type represented bytype, determined as if bydecltype_(element).is_swappable_with(decltype_(type)).Requirements#
typemust 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
MetaTyperepresenting 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
-
auto noexcept_swappable_with(MetaType auto type) noexcept#
Returns a metaprogramming predicate object used to query whether a
MetaTypeargument represents a type that isnoexceptswappable with the type represented bytype.A type,
type1, isnoexceptswappable with another type,type2, if , givenlhsandrhsthat 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 whetherargrepresents a typenoexceptswappable with the type represented bytype, determined as if bydecltype_(element).is_noexcept_swappable_with(decltype_(type)).Requirements#
typemust 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
MetaTyperepresenting the type to check fornoexceptswappability with- Returns:
A metaprogramming predicate object used to check that an argument represents a type that is
noexceptswappable with the type represented bytype
Variables
-
auto is_const =
[](MetaType auto type) noexcept {return decltype_(type).is_const();}# Metaprogramming predicate object used to query whether a
MetaTypeargument represents a type that isconstqualified.Determines whether the represented type is
constas if bydecltype_(type).is_const().Requirements#
typemust 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
MetaTyperepresenting the type to check that isconst- Return:
whether the type represented by
typeisconst
-
auto is_lvalue_reference =
[](MetaType auto type) noexcept {return decltype_(type).is_lvalue_reference();}# Metaprogramming predicate object used to query whether a
MetaTypeargument 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#
typemust 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
MetaTyperepresenting the type to check that is an lvalue-reference- Return:
whether the type represented by
typeis an lvalue-reference
-
auto is_rvalue_reference =
[](MetaType auto type) noexcept {return decltype_(type).is_rvalue_reference();}# Metaprogramming predicate object used to query whether a
MetaTypeargument 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#
typemust 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
MetaTyperepresenting the type to check that is an rvalue-reference- Return:
whether the type represented by
typeis an rvalue-reference
-
auto is_volatile =
[](MetaType auto type) noexcept {return decltype_(type).is_volatile();}# Metaprogramming predicate object used to query whether a
MetaTypeargument represents a type that isvolatilequalified.Determines whether the represented type is
volatileas if bydecltype_(type).is_volatile().Requirements#
typemust 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
MetaTyperepresenting the type to check that isvolatile- Return:
whether the type represented by
typeisvolatile
-
auto default_constructible =
[](MetaType auto type) noexcept {return decltype_(type).is_default_constructible();}# Metaprogramming predicate object used to query whether a
MetaTypeargument represents a type that is default constructible.Determines whether the represented type is default constructible, as if by
decltype_(type).is_default_constructible().Requirements#
typemust 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
MetaTyperepresenting the type to check that is default constructible- Return:
whether the type represented by
typeis default constructible
-
auto noexcept_default_constructible =
[](MetaType auto type) noexcept {return decltype_(type).is_noexcept_default_constructible();}# Metaprogramming predicate object used to query whether a
MetaTypeargument represents a type that isnoexceptdefault constructible.Determines whether the represented type is
noexceptdefault constructible, as if bydecltype_(type).is_noexcept_default_constructible().Requirements#
typemust 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
MetaTyperepresenting the type to check that isnoexceptdefault constructible- Return:
whether the type represented by
typeisnoexceptdefault constructible
-
auto trivially_default_constructible =
[](MetaType auto type) noexcept {return decltype_(type).is_trivially_default_constructible();}# Metaprogramming predicate object used to query whether a
MetaTypeargument 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#
typemust 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
MetaTyperepresenting the type to check that is trivially default constructible- Return:
whether the type represented by
typeis trivially default constructible
-
auto copy_constructible =
[](MetaType auto type) noexcept {return decltype_(type).is_copy_constructible();}# Metaprogramming predicate object used to query whether a
MetaTypeargument represents a type that is copy constructible.Determines whether the represented type is copy constructible, as if by
decltype_(type).is_copy_constructible().Requirements#
typemust 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
MetaTyperepresenting the type to check that is copy constructible- Return:
whether the type represented by
typeis copy constructible
-
auto noexcept_copy_constructible =
[](MetaType auto type) noexcept {return decltype_(type).is_noexcept_copy_constructible();}# Metaprogramming predicate object used to query whether a
MetaTypeargument represents a type that isnoexceptcopy constructible.Determines whether the represented type is
noexceptcopy constructible, as if bydecltype_(type).is_noexcept_copy_constructible().Requirements#
typemust 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
MetaTyperepresenting the type to check that isnoexceptcopy constructible- Return:
whether the type represented by
typeisnoexceptcopy constructible
-
auto trivially_copy_constructible =
[](MetaType auto type) noexcept {return decltype_(type).is_trivially_copy_constructible();}# Metaprogramming predicate object used to query whether a
MetaTypeargument 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#
typemust 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
MetaTyperepresenting the type to check that is trivially copy constructible- Return:
whether the type represented by
typeis trivially copy constructible
-
auto move_constructible =
[](MetaType auto type) noexcept {return decltype_(type).is_move_constructible();}# Metaprogramming predicate object used to query whether a
MetaTypeargument represents a type that is move constructible.Determines whether the represented type is move constructible, as if by
decltype_(type).is_move_constructible().Requirements#
typemust 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
MetaTyperepresenting the type to check that is move constructible- Return:
whether the type represented by
typeis move constructible
-
auto noexcept_move_constructible =
[](MetaType auto type) noexcept {return decltype_(type).is_noexcept_move_constructible();}# Metaprogramming predicate object used to query whether a
MetaTypeargument represents a type that isnoexceptmove constructible.Determines whether the represented type is
noexceptmove constructible, as if bydecltype_(type).is_noexcept_move_constructible().Requirements#
typemust 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
MetaTyperepresenting the type to check that isnoexceptmove constructible- Return:
whether the type represented by
typeisnoexceptmove constructible
-
auto trivially_move_constructible =
[](MetaType auto type) noexcept {return decltype_(type).is_trivially_move_constructible();}# Metaprogramming predicate object used to query whether a
MetaTypeargument 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#
typemust 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
MetaTyperepresenting the type to check that is trivially move constructible- Return:
whether the type represented by
typeis trivially move constructible
-
auto copy_assignable =
[](MetaType auto type) noexcept {return decltype_(type).is_copy_assignable();}# Metaprogramming predicate object used to query whether a
MetaTypeargument represents a type that is copy assignable.Determines whether the represented type is copy assignable, as if by
decltype_(type).is_copy_assignable().Requirements#
typemust 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
MetaTyperepresenting the type to check that is copy assignable- Return:
whether the type represented by
typeis copy assignable
-
auto noexcept_copy_assignable =
[](MetaType auto type) noexcept {return decltype_(type).is_noexcept_copy_assignable();}# Metaprogramming predicate object used to query whether a
MetaTypeargument represents a type that isnoexceptcopy assignable.Determines whether the represented type is
noexceptcopy assignable, as if bydecltype_(type).is_noexcept_copy_assignable().Requirements#
typemust 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
MetaTyperepresenting the type to check that isnoexceptcopy assignable- Return:
whether the type represented by
typeisnoexceptcopy assignable
-
auto trivially_copy_assignable =
[](MetaType auto type) noexcept {return decltype_(type).is_trivially_copy_assignable();}# Metaprogramming predicate object used to query whether a
MetaTypeargument 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#
typemust 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
MetaTyperepresenting the type to check that is trivially copy assignable- Return:
whether the type represented by
typeis trivially copy assignable
-
auto move_assignable =
[](MetaType auto type) noexcept {return decltype_(type).is_move_assignable();}# Metaprogramming predicate object used to query whether a
MetaTypeargument represents a type that is move assignable.Determines whether the represented type is move assignable, as if by
decltype_(type).is_move_assignable().Requirements#
typemust 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
MetaTyperepresenting the type to check that is move assignable- Return:
whether the type represented by
typeis move assignable
-
auto noexcept_move_assignable =
[](MetaType auto type) noexcept {return decltype_(type).is_noexcept_move_assignable();}# Metaprogramming predicate object used to query whether a
MetaTypeargument represents a type that isnoexceptmove assignable.Determines whether the represented type is
noexceptmove assignable, as if bydecltype_(type).is_noexcept_move_assignable().Requirements#
typemust 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
MetaTyperepresenting the type to check that isnoexceptmove assignable- Return:
whether the type represented by
typeisnoexceptmove assignable
-
auto trivially_move_assignable =
[](MetaType auto type) noexcept {return decltype_(type).is_trivially_move_assignable();}# Metaprogramming predicate object used to query whether a
MetaTypeargument 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#
typemust 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
MetaTyperepresenting the type to check that is trivially move assignable- Return:
whether the type represented by
typeis trivially move assignable
-
auto destructible =
[](MetaType auto type) noexcept {return decltype_(type).is_destructible();}# Metaprogramming predicate object used to query whether a
MetaTypeargument represents a type that is destructible.Determines whether the represented type is destructible, as if by
decltype_(type).is_destructible().Requirements#
typemust 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
MetaTyperepresenting the type to check that is destructible- Return:
whether the type represented by
typeis destructible
-
auto noexcept_destructible =
[](MetaType auto type) noexcept {return decltype_(type).is_noexcept_destructible();}# Metaprogramming predicate object used to query whether a
MetaTypeargument represents a type that isnoexceptdestructible.Determines whether the represented type is
noexceptdestructible, as if bydecltype_(type).is_noexcept_destructible().Requirements#
typemust 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
MetaTyperepresenting the type to check that isnoexceptdestructible- Return:
whether the type represented by
typeisnoexceptdestructible
-
auto trivially_destructible =
[](MetaType auto type) noexcept {return decltype_(type).is_trivially_destructible();}# Metaprogramming predicate object used to query whether a
MetaTypeargument represents a type that is trivially destructible.Determines whether the represented type is trivially destructible as if by
decltype_(type).is_trivially_destructible().Requirements#
typemust 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
MetaTyperepresenting the type to check that is trivially destructible- Return:
whether the type represented by
typeis trivially destructible
-
auto swappable =
[](MetaType auto type) noexcept {return decltype_(type).is_swappable();}# Metaprogramming predicate object used to query whether a
MetaTypeargument represents a type that is swappable.A type,
typeis swappable if , givenlhsandrhsthat are bothtype&,std::swap(lhs, rhs)is well-formed.Determines whether the represented type is swappable as if by
decltype_(type).is_swappable().Requirements#
typemust 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
MetaTyperepresenting the type to check for swappability- Return:
whether the type represented by
typeis swappable
-
auto noexcept_swappable =
[](MetaType auto type) noexcept {return decltype_(type).is_noexcept_swappable();}# Metaprogramming predicate object used to query whether a
MetaTypeargument represents a type that isnoexceptswappable.A type,
typeisnoexceptswappable if , givenlhsandrhsthat are bothtype&,std::swap(lhs, rhs)is well-formed andnoexcept.Determines whether the represented type is
noexceptswappable as if bydecltype_(type).is_noexcept_swappable().Requirements#
typemust 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
MetaTyperepresenting the type to check fornoexceptswappability- Return:
whether the type represented by
typeisnoexceptswappable