atria::meta Namespace Reference

Metaprogramming tools, including some Booost.MPL adaptors and concept checking facilities. More...

Classes

struct  bottom
 This is a type that pretends to be convertible to anything. More...
 
struct  common_type
 Similar to std::common_type but addresses several issues. More...
 
struct  common_type< T, Ts... >
 
struct  common_type<>
 
struct  copy_cv
 
struct  copy_decay
 Adds reference and cv-qualifications from OrigT to DestT. More...
 
struct  copy_reference
 
struct  copy_trait
 Metafunction that given a metafunction TraitCheckMf to check whether a type has a trait, and another TraitAddMf to add it to a type, returns TraitAddMf<DestT> if TraitCheckMf<OrigT>, else OrigT. More...
 
struct  could_not_find_common_type
 It is allowed to alias boost::mpl inside atria::meta. More...
 
struct  could_not_get_index_sequence
 
struct  detected_any
 Metafunction that returns the first type that is detected via the metafunctions in Ops... More...
 
struct  detected_any< T, Op >
 
struct  detected_any< T, Op, Ops... >
 
struct  from_void
 Type to enable making a type convertible from void. More...
 
struct  get_value_type
 Utility metafunction for accessing an underlying value type. More...
 
struct  identity
 Identity metafunction. More...
 
struct  if_any
 Metafunction that given a type T and a one or more of MPL metafunction classes Mfs that boolean metafunctions, returns whether any of these metafunctios Mfs returns true when applied with T. More...
 
struct  if_any< T, Mf >
 
struct  if_any< T, Mf, Mfs... >
 
struct  lazy_detected_or
 Like estd::detected_or, but evaluates D lazily. More...
 
struct  lazy_enable_if
 
struct  models
 Returns whether a concept signature ConceptSig is satisfied. More...
 
struct  models< ConceptSpecT(Ts...), estd::void_t< decltype(std::declval< ConceptSpecT >().requires_( std::declval< Ts >()...)) > >
 
struct  models_
 
struct  noop_t
 Does nothing. More...
 
struct  pack
 MPL-compatible sequence that just holds a vector of types as a paremeter pack. More...
 
struct  pack_iterator
 
struct  pack_iterator< atria::meta::pack< Args... > >
 
struct  std_tuple_iterator
 
struct  std_tuple_iterator< std::tuple< Args... > >
 

Typedefs

template<typename... Ts>
using common_type_t = typename common_type< Ts... >::type
 C++14 style alias for common_type More...
 
template<bool Requirement>
using require = estd::enable_if_t< Requirement, int >
 Utility to define concepts in terms of other concepts or other kinds boolean requirements. More...
 
template<typename T , typename... Mfs>
using require_any = estd::enable_if_t< if_any< T, Mfs... >::type::value, int >
 Like require, but based on the semantics of if_any. More...
 
template<typename D , template< class... > class Op, typename T >
using lazy_detected_or_t = eval_t< lazy_detected_or< D, Op, T > >
 
template<typename T , template< class... > class... Ops>
using detected_any_t = typename detected_any< T, Ops... >::type
 
template<typename T >
using eval_t = typename T::type
 Alias to access typename T::type More...
 
template<typename T , typename I >
using get_integer_sequence = typename detail::get_integer_sequence< estd::decay_t< T >, I >::type
 
template<typename T >
using get_index_sequence = get_integer_sequence< T, std::size_t >
 
template<bool C, typename T >
using lazy_enable_if_t = meta::eval_t< lazy_enable_if< C, T > >
 
template<template< typename... > class MF, typename T >
using unpack = typename detail::unpack< MF, T >::type
 Metafunction that given a variadic template MF and a type ArgT, returns MF<ArgT>, or if ArgT is of the form pack<Args...> then returns MF<Args...>. More...
 
template<template< typename... > class MF, typename T >
using unpack_t = typename unpack< MF, T >::type
 
template<typename T >
using value_t = eval_t< get_value_type< estd::decay_t< T > > >
 Convenient alias for get_value_type More...
 

Functions

constexpr bool all ()
 Returns true if all the passed in values are true. More...
 
template<typename T , typename... Ts>
constexpr bool all (T x, Ts...xs)
 
template<typename... Ts>
constexpr bool valid ()
 Concept that is always satisfied by the type or family of types that is passed to it. More...
 
template<typename... Ts>
void expressions (Ts &&...)
 Allows to validate a sequence of expressions in a single decltype. More...
 
template<typename ConceptSig >
constexpr bool check ()
 Like models, but fails at compile-time when the specification is not met. More...
 
template<typename ConceptSpecT , typename... Ts>
constexpr bool check (pack< ConceptSpecT(Ts...)>)
 
template<template< typename... >class ConceptSpecT, typename... Ts>
constexpr bool check (pack< ConceptSpecT< Ts... > >)
 
 ABL_DEFINE_COPY_STD_TRAIT (lvalue_reference)
 
 ABL_DEFINE_COPY_STD_TRAIT (rvalue_reference)
 
 ABL_DEFINE_COPY_STD_TRAIT (volatile)
 
 ABL_METAFUNCTION_T (copy_cv)
 
 ABL_METAFUNCTION_T (copy_reference)
 
 ABL_METAFUNCTION_T (copy_decay)
 
template<typename... Ts1, typename... Ts2>
constexpr bool operator== (const pack< Ts1... > &, const pack< Ts2... > &)
 Two packs are equal if they are of the same type. More...
 
template<typename... Ts1, typename... Ts2>
constexpr bool operator!= (const pack< Ts1... > &, const pack< Ts2... > &)
 Two packs are different if they are of different types. More...
 

Variables

constexpr struct atria::meta::noop_t noop
 
constexpr int can_be_void = 42
 Use to allow a void expression by chaining it in a comma operator thing. More...
 

Detailed Description

Metaprogramming tools, including some Booost.MPL adaptors and concept checking facilities.

Typedef Documentation

using common_type_t = typename common_type<Ts...>::type

C++14 style alias for common_type

Definition at line 132 of file common_type.hpp.

using eval_t = typename T::type

Alias to access typename T::type

Definition at line 36 of file eval.hpp.

using require = estd::enable_if_t<Requirement, int>

Utility to define concepts in terms of other concepts or other kinds boolean requirements.

For example:

template <typename Arg>
struct Inout_value
: meta::concept<Inout_value<Arg> >
{
template <typename T>
auto requires_(T&& x) -> decltype(
meta::require<(In_value<T>())>(),
meta::require<(Out_value<T>())>()));
};

Definition at line 110 of file concept.hpp.

using require_any = estd::enable_if_t< if_any<T, Mfs...>::type::value, int>

Like require, but based on the semantics of if_any.

Definition at line 282 of file concept.hpp.

using unpack = typename detail::unpack<MF, T>::type

Metafunction that given a variadic template MF and a type ArgT, returns MF<ArgT>, or if ArgT is of the form pack<Args...> then returns MF<Args...>.

Definition at line 101 of file pack.hpp.

Convenient alias for get_value_type

Definition at line 76 of file value_type.hpp.

Function Documentation

constexpr bool atria::meta::all ( )

Returns true if all the passed in values are true.

Definition at line 70 of file concept.hpp.

constexpr bool atria::meta::check ( )

Like models, but fails at compile-time when the specification is not met.

This is useful when debugging concept mismatches, as it will normally fail at the line of the specification that is not met. However, it is not usable in SFINAE contexes.

Definition at line 176 of file concept.hpp.

void atria::meta::expressions ( Ts &&  ...)

Allows to validate a sequence of expressions in a single decltype.

Useful in combination with Valid. Not defined, use only in non-evaluated contexts.

constexpr bool atria::meta::operator!= ( const pack< Ts1... > &  ,
const pack< Ts2... > &   
)

Two packs are different if they are of different types.

Definition at line 74 of file pack.hpp.

constexpr bool atria::meta::operator== ( const pack< Ts1... > &  ,
const pack< Ts2... > &   
)

Two packs are equal if they are of the same type.

Definition at line 65 of file pack.hpp.

constexpr bool atria::meta::valid ( )

Concept that is always satisfied by the type or family of types that is passed to it.

Useful to simply check expressions about a type, using decltype expresions on a Valid<>().

Definition at line 87 of file concept.hpp.

Variable Documentation

constexpr int can_be_void = 42

Use to allow a void expression by chaining it in a comma operator thing.

A use-case is when expanding calls to variadic arguments that might be void, as in:

template <typename ...Args>
void do_foo(Args& args)
{
using namespace meta;
noop((args.foo(), can_be_void)...);
}

Another example is when writing concepts checking expressions that can be void, as in:

template <typename Arg1, typename Arg2=Arg1>
struct swapable : concept<swapable<Arg1, Arg2>>
{
template <typename T, typename U>
auto requires_(T&& x, T&& y) -> decltype(
(swap(x, y), can_be_void),
(swap(y, x), can_be_void)));
};

Definition at line 103 of file utils.hpp.

Fork me on GitHub