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 member using alias type. Maps TType in the following manner:

    • If TType is a MetaType, maps to Type<typename as_meta<typename TType::type>::type>, else

    • If TType is a MetaValue, maps to Value<TType::value>, else

    • If TType is a MetaPair, maps to

      Pair<typename as_meta<typename TType::first>::type,
           typename as_meta<typename TType::second>::type>
      
      , else

    • Maps to Type<TType>

  • struct as_raw: Exposition-only template metafunction that converts a type, TType, to the corresponding raw type, exposed via the member using alias type. Maps TType in the following manner:

    • If TType is a MetaType, maps to typename as_raw<typename TType::type>::type, else

    • If TType is a MetaValue, maps to Value<TType::value>, else

    • If TType is a MetaPair, maps to

      Pair<typename as_raw<typename TType::first>::type,
           typename as_raw<typename TType::second>::type>
      
      , else

    • 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 whether arg is equal to value. Equality is determined, using the exposition-only template metafunction as_meta (see the corresponding section in the Metaprogramming List Type module-level documentation), as if by:

constexpr 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;
If arg and value do not fulfill the same metaprogramming type concept (e.g. if arg is MetaValue but value is MetaType), always returns Value<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 whether arg is not equal to value. Inequality is determined, using the exposition-only template metafunction as_meta (see the corresponding section in the Metaprogramming List Type module-level documentation), as if by:

constexpr 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;
If arg and value do not fulfill the same metaprogramming type concept (e.g. if arg is MetaValue but value is MetaType), always returns Value<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 whether arg is less than value, 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#

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 whether arg is less than or equal to value, 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#

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 whether arg is greater than value, 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#

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 whether arg is greater than or equal to value, 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#

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 as type.

The returned metaprogramming predicate object has call operator equivalent to constexpr operator()(MetaType auto arg) noexcept, that when invoked, returns whether arg represents the same type as type, 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 a MetaType

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 with MetaTypes, whereas equal_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 by type.

The returned metaprogramming predicate object has call operator equivalent to constexpr operator()(MetaType auto arg) noexcept, that when invoked, returns whether arg represents the same type as, or a qualification of, the type represented by type, 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 a MetaType

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 by type.

The returned metaprogramming predicate object has call operator equivalent to constexpr operator()(MetaType auto arg) noexcept, that when invoked, returns whether arg represents a type convertible to the type represented by type, determined as if by decltype_(element).is_convertible_to(decltype_(type)).

Requirements#

  • type must be an instance of a MetaType

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 by type.

The returned metaprogramming predicate object has call operator equivalent to constexpr operator()(MetaType auto arg) noexcept, that when invoked, returns whether arg represents a type derived from the type represented by type, determined as if by decltype_(element).is_derived_from(decltype_(type)).

Requirements#

  • type must be an instance of a MetaType

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 by type.

The returned metaprogramming predicate object has call operator equivalent to constexpr operator()(MetaType auto arg) noexcept, that when invoked, returns whether arg represents a type that is a base of the type represented by type, determined as if by decltype_(element).is_base_of(decltype_(type)).

Requirements#

  • type must be an instance of a MetaType

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 by types....

The returned metaprogramming predicate object has call operator equivalent to constexpr operator()(MetaType auto arg) noexcept, that when invoked, returns whether arg represents a type constructible from the types represented by types..., determined as if by decltype_(element).is_constructible_from(decltype_(types)...).

Requirements#

  • types... must be instances of a MetaTypes

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 types TTypes....

The returned metaprogramming predicate object has call operator equivalent to constexpr operator()(MetaType auto arg) noexcept, that when invoked, returns whether arg represents a type constructible from the raw types represented by TTypes.... That is, if any type type of TTypes... is a MetaType, the check will use the wrapped type of type, typename type::type (this guarantee is provided by mpl::Type::is_constructible_from). The constructibility is determined as if by decltype_(element).is_constructible_from(types).

Requirements#

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 type noexcept constructible from a pack of parameters of the types represented by types....

The returned metaprogramming predicate object has call operator equivalent to constexpr operator()(MetaType auto arg) noexcept, that when invoked, returns whether arg represents a type noexcept constructible from the types represented by types..., determined as if by decltype_(element).is_noexcept_constructible_from(decltype_(types)...).

Requirements#

  • types... must be instances of a MetaTypes

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 for noexcept 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 by types...

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 type noexcept constructible from a pack of parameters of the types TTypes....

The returned metaprogramming predicate object has call operator equivalent to constexpr operator()(MetaType auto arg) noexcept, that when invoked, returns whether arg represents a type noexcept constructible from the raw types represented by TTypes.... That is, if any type type of TTypes... is a MetaType, the check will use the wrapped type of type, typename type::type (this guarantee is provided by mpl::Type::is_constructible_from). The constructibility is determined as if by decltype_(element).is_noexcept_constructible_from(types).

Requirements#

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 with

  • TTypes – 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 by types

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 by type.

A type, type1, is swappable with another type, type2, if , given lhs and rhs that are type1& and type2&, respectively, std::swap(lhs, rhs) and std::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 whether arg represents a type swappable with the type represented by type, determined as if by decltype_(element).is_swappable_with(decltype_(type)).

Requirements#

  • type must be an instance of a MetaType

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 is noexcept swappable with the type represented by type.

A type, type1, is noexcept swappable with another type, type2, if , given lhs and rhs that are type1& and type2&, respectively, std::swap(lhs, rhs) and std::swap(rhs, lhs) are both well-formed and noexcept.

The returned metaprogramming predicate object has call operator equivalent to constexpr operator()(MetaType auto arg) noexcept, that when invoked, returns whether arg represents a type noexcept swappable with the type represented by type, determined as if by decltype_(element).is_noexcept_swappable_with(decltype_(type)).

Requirements#

  • type must be an instance of a MetaType

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 for noexcept swappability with

Returns:

A metaprogramming predicate object used to check that an argument represents a type that is noexcept swappable with the type represented by type

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 is const qualified.

Determines whether the represented type is const as if by decltype_(type).is_const().

Requirements#

  • type must be an instance of a MetaType

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 is const

Return:

whether the type represented by type is const

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 a MetaType

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 a MetaType

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 is volatile qualified.

Determines whether the represented type is volatile as if by decltype_(type).is_volatile().

Requirements#

  • type must be an instance of a MetaType

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 is volatile

Return:

whether the type represented by type is volatile

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 a MetaType

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 is noexcept default constructible.

Determines whether the represented type is noexcept default constructible, as if by decltype_(type).is_noexcept_default_constructible().

Requirements#

  • type must be an instance of a MetaType

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 is noexcept default constructible

Return:

whether the type represented by type is noexcept 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 a MetaType

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 a MetaType

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 is noexcept copy constructible.

Determines whether the represented type is noexcept copy constructible, as if by decltype_(type).is_noexcept_copy_constructible().

Requirements#

  • type must be an instance of a MetaType

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 is noexcept copy constructible

Return:

whether the type represented by type is noexcept 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 a MetaType

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 a MetaType

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 is noexcept move constructible.

Determines whether the represented type is noexcept move constructible, as if by decltype_(type).is_noexcept_move_constructible().

Requirements#

  • type must be an instance of a MetaType

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 is noexcept move constructible

Return:

whether the type represented by type is noexcept 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 a MetaType

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 a MetaType

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 is noexcept copy assignable.

Determines whether the represented type is noexcept copy assignable, as if by decltype_(type).is_noexcept_copy_assignable().

Requirements#

  • type must be an instance of a MetaType

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 is noexcept copy assignable

Return:

whether the type represented by type is noexcept 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 a MetaType

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 a MetaType

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 is noexcept move assignable.

Determines whether the represented type is noexcept move assignable, as if by decltype_(type).is_noexcept_move_assignable().

Requirements#

  • type must be an instance of a MetaType

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 is noexcept move assignable

Return:

whether the type represented by type is noexcept 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 a MetaType

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 a MetaType

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 is noexcept destructible.

Determines whether the represented type is noexcept destructible, as if by decltype_(type).is_noexcept_destructible().

Requirements#

  • type must be an instance of a MetaType

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 is noexcept destructible

Return:

whether the type represented by type is noexcept 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 a MetaType

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 , given lhs and rhs that are both type&, 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 a MetaType

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 is noexcept swappable.

A type, type is noexcept swappable if , given lhs and rhs that are both type&, std::swap(lhs, rhs) is well-formed and noexcept.

Determines whether the represented type is noexcept swappable as if by decltype_(type).is_noexcept_swappable().

Requirements#

  • type must be an instance of a MetaType

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 for noexcept swappability

Return:

whether the type represented by type is noexcept swappable