mpl
#
Header: <pressio/mpl.hpp>
Public namespace: pressio::mpl
Scope#
Provides metaprogramming functionalities needed to
support generic programming, which is a fundamental
building block of the pressio library.
If you are familiar with the <type_traits>
header from
the standard library, the pressio/mpl
will look familiar too.
Some parts of pressio/mpl
have been adapted from the tinympl project.
The tinympl project appears to be no longer maintained.
The following is a partial list only intended to provide a general idea of the supported features.
To find out all supported cases, browse the source.
pressio::mpl::all_of
#
template< template<class ... T> class F, class ... Args> struct all_of;
Determines whether every element in the sequence satisfies the given predicate. The predicate
F
must be such thatF<T>::value
must be convertible tobool
. Provides the static member constantvalue
that is equal to true iff all the elements in the sequence satisfy the predicateF
. Otherwise, value is false.Example:
namespace pmpl = pressio::mpl; static_assert(pmpl::all_of<std::is_floating_point, double, float>::value, "" );
pressio::mpl::any_of
#
template< template<class ... T> class F, class ... Args> struct any_of;
Determines whether any element in the sequence satisfies the given predicate. The predicate
F
must be such thatF<T>::value
must be convertible tobool
. Provides the static member constantvalue
that is equal to true iff at least one element in the sequence satisfies the predicateF
. Otherwise, value is equal to false.
pressio::mpl::none_of
#
template< template<class ... T> class F, class ... Args> struct none_of;
Determines whether none of the elements in the sequence satisfy the given predicate. The predicate
F
must be such thatF<T>::value
must be convertible tobool
. Provides the static member constantvalue
that is equal to true iff none of the elements in the sequence satisfy the predicateF
. Otherwise, value is equal to false.
pressio::mpl::is_subscriptable_as
#
template<class T, class IndexType> struct is_subscriptable_as;
Provides the static member constant
value
that is equal to true ifT
has subscript operator[]
, it can be indexed by an instance ofIndexType
, and the return type is not void. Otherwise, value is equal to false.