4.4.1
Freundlich's C++ toolkit
Loading...
Searching...
No Matches
Classes | Typedefs | Functions | Variables
fcppt.mpl

Description

A metaprogramming library.

Introduction

MPL stands for meta programming library and refers to the fact that you can write "programs" using C++ templates. As an example, consider the following variant type:

template<typename... Types> class variant
{

First of all, an implementation would have to check if Types... are disjoint. Second of all, it would have to gather the sizes of all the types. This can all be written by hand, often using recursion on a template parameter pack, or it can be done using a MP library:

using type_list = fcppt::mpl::list::object<Types...>;
template<typename T>
using sizeof_ = fcppt::mpl::size_type<sizeof(T)>;
};

There are two key concepts here:

fcppt::mpl::list::distinct expects an fcppt::mpl::list::object and returns std::true_type if all types in the list are distinct and std::false_type otherwise.

fcppt::mpl::list::map applies an fcppt::mpl::lambda to every element of a list. For example, if type_list = fcppt::mpl::object::list<int, float>, then sizes = fcppt::mpl::list::object<sizeof_<int>,sizeof_<float>>.

Lambdas

To understand how to write MP algorithms, it is important to understand lambdas and how they can be combined. The definition of fcppt::mpl::lambda is

template<template<typename...> class F> struct lambda;

This way, it can take any template of arbitrary arity:

Here, add_pointer is a unary lambda and common_type is a binary lambda. Since fcppt::mpl::list::object is a variadic template, make_list is a variadic lambda.

To actually call a lambda, we use fcppt::mpl::apply:

static_assert(std::is_same_v<r1,int *>);
static_assert(std::is_same_v<r2,int>);
static_assert(std::is_same_v<r3,fcppt::mpl::list::object<int,float>>);

Note that providing the wrong number of template parameters will lead to a compile error, for example fcppt::mpl::apply<add_pointer,int,float> will not compile.

As terminology, we say that a lambda L holds a function F of arity n, if L = fcppt::mpl::lambda<F> and F is either an n-ary template or a variadic template.

Now consider the following example: We would like to create a lambda that evaluates to true if and only if the first parameter is int. We can implement this writing an explicit function:

template<typename T>
using is_int_impl = std::is_same<T,int>;

To do this more directly, we can also write the following code:

To understand why these are equivalent, we have to understand what fcppt::mpl::arg, fcppt::mpl::constant and fcppt::mpl::bind do.

In our example, fcppt::mpl::lambda<std::is_same> holds a function or arity 2, and both fcppt::mpl::arg<1> and fcppt::mpl::constant<int> hold functions or arity 1. Therefore, we have k=2 and m=1 and is_int2 holds a function of arity 1. We have

= std::is_same<fcppt::mpl::apply<fcppt::mpl::arg<1>,T>,fcppt::mpl::apply<fcppt::mpl::constant<int>,T>>
= std::is_same<T,int>

Classes

struct  fcppt::mpl::lambda< F >
 The lambda type. More...
 
struct  fcppt::mpl::list::object< Args >
 The list type used by this library. More...
 
struct  fcppt::mpl::map::element< Key, Value >
 The element type of a map.An element of a map is a key-value pair. More...
 
struct  fcppt::mpl::map::object< Args >
 The map type used by this library. More...
 
struct  fcppt::mpl::set::object< Args >
 The set type used by this library.A map is constructed from a variadic list of types, which must be pairwise disjoint. More...
 

Typedefs

template<fcppt::mpl::integral_concept T1, fcppt::mpl::integral_concept T2>
using fcppt::mpl::add = typename fcppt::mpl::detail::add< T1, T2 >::type
 Adds two integral constants.Let T1 = std::integral_constant<T,V_1> and T2 = std::integral_constant<T,V_2>. Then the result is std::integral_constant<T,V_1 + V_2>.
 
template<fcppt::mpl::lambda_concept L, typename... Args>
using fcppt::mpl::apply = typename fcppt::mpl::detail::apply< L, Args... >::type
 Calls a lambda.
 
template<std::size_t Arg>
using fcppt::mpl::arg = typename fcppt::mpl::detail::arg< Arg - 1U >::type
 A lambda that returns an argument in a specific position.
 
template<fcppt::mpl::lambda_concept L, fcppt::mpl::lambda_concept ... Ls>
using fcppt::mpl::bind = typename fcppt::mpl::detail::bind< L, Ls... >::type
 Function composition on multiple lambdas.
 
template<typename T >
using fcppt::mpl::constant = typename fcppt::mpl::detail::constant< T >::type
 The constant lambda.
 
template<fcppt::mpl::integral_concept T>
using fcppt::mpl::dec = typename fcppt::mpl::detail::dec< T >::type
 Subtracts one from an integral constant.Let T = std::integral_constant<U,V>. Then the result is std::integral_constant<U,V-->.
 
template<typename Function >
using fcppt::mpl::function_args = typename fcppt::mpl::detail::function_args< Function >::type
 The argument types of a function as a list.
 
template<fcppt::mpl::integral_concept T1, fcppt::mpl::integral_concept T2>
using fcppt::mpl::greater = typename fcppt::mpl::detail::greater< T1, T2 >::type
 Checks if one integral constant is greater than another.Let T1 = std::integral_constant<T,V_1> and T2 = std::integral_constant<T,V_2>. Then the result is std::bool_constant<(V1 > V2)>.
 
template<fcppt::mpl::bool_concept B, typename T , typename F >
using fcppt::mpl::if_ = std::conditional_t< B::value, T, F >
 The if-then-else function.Similar to std::conditional_t but takes a bool_concept, i.e., a std::bool_constant<V> for any bool V instead of V directly.
 
template<typename F , fcppt::mpl::list::object_concept L>
using fcppt::mpl::is_invocable = fcppt::mpl::list::apply< fcppt::mpl::lambda< std::is_invocable >, fcppt::mpl::list::push_front< L, F > >
 Checks if a function can be invoked with a given argument list.Checks if function F can be invoked with the types in L, i.e. if L = list::object<L_1,...,L_n>, then the result is.
 
template<typename T >
using fcppt::mpl::is_lambda = typename fcppt::mpl::detail::is_lambda< T >::type
 Checks if a type is a lambda.
 
template<typename T >
using fcppt::mpl::is_size_type = typename fcppt::mpl::detail::is_size_type< T >::type
 Checks if a type is a size_type.T is a size type if and only if it is of the form fcppt::mpl::size_type<N> for some std::size_t N.
 
template<fcppt::mpl::integral_concept T1, fcppt::mpl::integral_concept T2>
using fcppt::mpl::less = typename fcppt::mpl::detail::less< T1, T2 >::type
 Checks if one integral constant is less than another.Let T1 = std::integral_constant<T,V_1> and T2 = std::integral_constant<T,V_2>. Then the result is std::bool_constant<(V1 < V2)>.
 
template<fcppt::mpl::list::object_concept List, fcppt::mpl::lambda_concept L>
using fcppt::mpl::list::all_of = fcppt::mpl::list::fold< List, fcppt::mpl::bind< fcppt::mpl::lambda< std::conjunction >, fcppt::mpl::bind< L, fcppt::mpl::arg< 1 > >, fcppt::mpl::arg< 2 > >, std::true_type >
 Checks if a predicate holds for all types of a list.If List=list::object<L_1,...,L_n> and L holds a function F of arity 1, then the result is.
 
template<fcppt::mpl::list::object_concept List, fcppt::mpl::lambda_concept L>
using fcppt::mpl::list::any_of = fcppt::mpl::list::fold< List, fcppt::mpl::bind< fcppt::mpl::lambda< std::disjunction >, fcppt::mpl::bind< L, fcppt::mpl::arg< 1 > >, fcppt::mpl::arg< 2 > >, std::false_type >
 Checks if a predicate holds for any type of a list.If List=list::object<L_1,...,L_n> and L holds a function F of arity 1, then the result is.
 
template<fcppt::mpl::list::object_concept List1, fcppt::mpl::list::object_concept List2>
using fcppt::mpl::list::append = typename fcppt::mpl::list::detail::append< List1, List2 >::type
 Appends two lists.If List1 = list::object<L_1,...,L_n> and List2 = list::object<R_1,...,R_m> then the result is.
 
template<fcppt::mpl::lambda_concept L, fcppt::mpl::list::object_concept Args>
using fcppt::mpl::list::apply = typename fcppt::mpl::list::detail::apply< L, Args >::type
 Calls a lambda using a list of arguments.
 
template<fcppt::mpl::list::object_concept List, fcppt::mpl::size_type_concept Index>
using fcppt::mpl::list::at = typename fcppt::mpl::list::detail::at< List, Index >::type
 The element of a list at a given position.If List = list::object<L_1,...,L_n> and Index = fcppt::mpl::size_type<j> with 0 <= j < n then the result is L_{j-1}.
 
template<fcppt::mpl::list::object_concept List>
using fcppt::mpl::list::back = fcppt::mpl::list::at< List, fcppt::mpl::dec< fcppt::mpl::list::size< List > > >
 The last element of a list.If List = list::object<L_1,...,L_n> then the result is L_n.
 
template<fcppt::mpl::list::object_concept List, typename E >
using fcppt::mpl::list::contains = fcppt::mpl::list::any_of< List, fcppt::mpl::bind< fcppt::mpl::lambda< std::is_same >, fcppt::mpl::arg< 1 >, fcppt::mpl::constant< E > > >
 Checks if a list contains an element.Let List = list::object<L_1,...,L_n>. The result is std::true_type if E = L_i for some 1 <= i <= n. Otherwise, it is std::false_type.
 
template<fcppt::mpl::list::object_concept List>
using fcppt::mpl::list::distinct = typename fcppt::mpl::list::detail::distinct< List >::type
 Checks if all elements of a list are pairwise disjoint.Let List = list::object<L_1,...,L_n>. If L_i != L_j for all 1 <= i != j <= n then the result is std::true_type. Otherwise, it is std::false_type.
 
template<fcppt::mpl::list::object_concept List, fcppt::mpl::size_type_concept S>
using fcppt::mpl::list::drop = fcppt::mpl::list::map< fcppt::mpl::list::interval< S, fcppt::mpl::list::size< List > >, fcppt::mpl::bind< fcppt::mpl::lambda< fcppt::mpl::list::at >, fcppt::mpl::constant< List >, fcppt::mpl::arg< 1 > > >
 Removes some elements of a list from the beginning.If List = list::object<L_1,...,L_n> then the result is.
 
template<fcppt::mpl::list::object_concept List>
using fcppt::mpl::list::empty = std::is_same< fcppt::mpl::list::size< List >, fcppt::mpl::size_type< 0U > >
 Checks if a list is empty.Let List = list::object<L_1,...,L_n>. If n = 0 then std::true_type is returned. Otherwise, std::false_typeis returned.
 
template<fcppt::mpl::list::object_concept List, fcppt::mpl::lambda_concept L, typename V >
using fcppt::mpl::list::fold = typename fcppt::mpl::list::detail::fold< List, L, V >::type
 Folds a list.
 
template<typename Type >
using fcppt::mpl::list::from = typename fcppt::mpl::list::detail::from< Type >::type
 Converts a template type to a list.If Type = T<L_1, ..., L_n> then the result is list::object<L_1,...,L_n>.
 
template<fcppt::mpl::list::object_concept List>
using fcppt::mpl::list::front = typename fcppt::mpl::list::detail::front< List >::type
 The first element of a list.If List = list::object<L_1,...,L_n> then the result is L_1.
 
template<fcppt::mpl::list::object_concept List, typename E >
using fcppt::mpl::list::index_of = fcppt::mpl::list::index_of_if< List, fcppt::mpl::bind< fcppt::mpl::lambda< std::is_same >, fcppt::mpl::constant< E >, fcppt::mpl::arg< 1 > > >
 The first index of a given element inside a list.Let List = list::object<L_1,...,L_n>. Returns size_type<Index> where Index is the smallest number such that L_{Index} = E.
 
template<fcppt::mpl::list::object_concept List, fcppt::mpl::lambda_concept L>
using fcppt::mpl::list::index_of_if = typename fcppt::mpl::list::detail::index_of_if< List, L, fcppt::mpl::size_type< 0U > >::type
 The first index where an element matches a predicate inside a list.Let List = list::object<L_1,...,L_n> and let L hold a function F of arity 1. Returns size_type<Index> where Index is the smallest number such that F<L_{Index}> = std::true_type.
 
template<fcppt::mpl::list::object_concept List>
using fcppt::mpl::list::indices = fcppt::mpl::list::interval< fcppt::mpl::size_type< 0U >, fcppt::mpl::list::size< List > >
 Returns the positions of a list.If List = list::object<L_1,...,L_n> then the result is.
 
template<fcppt::type_traits::integral_constant_concept Begin, fcppt::type_traits::integral_constant_concept End>
using fcppt::mpl::list::interval = typename fcppt::mpl::list::detail::interval< std::make_integer_sequence< fcppt::type_traits::value_type< Begin >, End::value - Begin::value >, Begin >::type
 Return the interval between two numbers.If Begin = std::integral_constant<Type,B> and End = std::integral_constant<Type,E> then the result is.
 
template<typename T >
using fcppt::mpl::list::is_object = typename fcppt::mpl::list::detail::is_object< T >::type
 Checks if a type is a list.
 
template<fcppt::mpl::list::object_concept List>
using fcppt::mpl::list::join = fcppt::mpl::list::fold< List, fcppt::mpl::bind< fcppt::mpl::lambda< fcppt::mpl::list::append >, fcppt::mpl::arg< 2 >, fcppt::mpl::arg< 1 > >, fcppt::mpl::list::object<> >
 Joins a list of lists.If List = list::object<L_1,...,L_n> and L_1, ..., L_n are lists, then the result is.
 
template<fcppt::mpl::list::object_concept List, fcppt::mpl::lambda_concept Pred>
using fcppt::mpl::list::keep_if = fcppt::mpl::list::remove_if< List, fcppt::mpl::bind< fcppt::mpl::lambda< std::negation >, Pred > >
 Only keeps elements that satisfy a predicate.Keeps the elements of List for which Pred is std::true_type. The order of the elements stays the same.
 
template<fcppt::mpl::list::object_concept List, fcppt::mpl::lambda_concept F>
using fcppt::mpl::list::map = typename fcppt::mpl::list::detail::map< List, F >::type
 Applies a lambda to every element of a list.If List=list::object<L_1,...,L_n> and L holds a function F of arity 1, then the result is.
 
template<fcppt::mpl::lambda_concept F, fcppt::mpl::list::object_concept... Lists>
using fcppt::mpl::list::map_multi = fcppt::mpl::list::map< fcppt::mpl::list::transpose< fcppt::mpl::list::object< Lists... > >, fcppt::mpl::bind< fcppt::mpl::lambda< fcppt::mpl::list::apply >, fcppt::mpl::constant< F >, fcppt::mpl::arg< 1 > > >
 Applies an n-ary lambda to every element-tuple of n lists.If Lists=list::object<L_{1,1},...,L_{1,k}>, ... list::object<L_{1,n},...,L_{n,k}> and L holds a function F of arity n, then the result is.
 
template<typename Sequence >
using fcppt::mpl::list::maximum = fcppt::mpl::list::fold< Sequence, fcppt::mpl::bind< fcppt::mpl::lambda< fcppt::mpl::if_ >, fcppt::mpl::bind< fcppt::mpl::lambda< fcppt::mpl::greater >, fcppt::mpl::arg< 1 >, fcppt::mpl::arg< 2 > >, fcppt::mpl::arg< 1 >, fcppt::mpl::arg< 2 > >, fcppt::mpl::list::front< Sequence > >
 Calculates the maximum value of a list.
 
template<fcppt::mpl::list::object_concept List>
using fcppt::mpl::list::pop_back = typename fcppt::mpl::list::detail::pop_back< fcppt::mpl::list::object<>, List >::type
 Removes the last element of a list.If List = list::object<L_1,...,L_n>, where n >= 1, then the result is.
 
template<fcppt::mpl::list::object_concept List, typename T >
using fcppt::mpl::list::push_back = typename fcppt::mpl::list::detail::push_back< List, T >::type
 Adds an element to the back of a list.If List = list::object<L_1,...,L_n>, then the result is.
 
template<fcppt::mpl::list::object_concept List, typename T >
using fcppt::mpl::list::push_front = typename fcppt::mpl::list::detail::push_front< List, T >::type
 Adds an element to the front of a list.If List = list::object<L_1,...,L_n>, then the result is.
 
template<fcppt::mpl::list::object_concept List, typename T >
using fcppt::mpl::list::remove = fcppt::mpl::list::remove_if< List, fcppt::mpl::bind< fcppt::mpl::lambda< std::is_same >, fcppt::mpl::constant< T >, fcppt::mpl::arg< 1 > > >
 Removes a specific type from a list.Removes every occurrence of T from List. The order of the remaining elements stays the same.
 
template<fcppt::mpl::list::object_concept List, fcppt::mpl::lambda_concept Pred>
using fcppt::mpl::list::remove_if = fcppt::mpl::list::fold< List, fcppt::mpl::bind< fcppt::mpl::lambda< fcppt::mpl::if_ >, fcppt::mpl::bind< Pred, fcppt::mpl::arg< 1 > >, fcppt::mpl::arg< 2 >, fcppt::mpl::bind< fcppt::mpl::lambda< fcppt::mpl::list::push_back >, fcppt::mpl::arg< 2 >, fcppt::mpl::arg< 1 > > >, fcppt::mpl::list::object<> >
 Removes the elements that satisfy a predicate.Removes the elements of List for which Pred is std::true_type. The order of the remaining elements stays the same.
 
template<typename T , fcppt::mpl::size_type_concept S>
using fcppt::mpl::list::repeat = fcppt::mpl::list::map< fcppt::mpl::list::interval< fcppt::mpl::size_type< 0U >, S >, fcppt::mpl::constant< T > >
 Creates a list that consists of n elements that are all the same.Let S = fcppt::mpl::size_type<n>. Then the result is.
 
template<fcppt::mpl::list::object_concept List>
using fcppt::mpl::list::size = typename fcppt::mpl::list::detail::size< List >::type
 The size of a list.If List = list::object<L_1,...,L_n> then the result is fcppt::mpl::size_type<n>.
 
template<fcppt::mpl::list::object_concept List>
using fcppt::mpl::list::tail = typename fcppt::mpl::list::detail::tail< List >::type
 Removes the first element of a list.If List = list::object<L_1,...,L_n>, where n >= 1, then the result is.
 
template<fcppt::mpl::list::object_concept List, fcppt::mpl::size_type_concept S>
using fcppt::mpl::list::take = typename fcppt::mpl::list::detail::take< List, std::make_index_sequence< S::value > >::type
 Keeps some elements of a list from the beginning.If List = list::object<L_1,...,L_n> then the result is.
 
template<fcppt::mpl::list::object_concept List>
using fcppt::mpl::list::transpose = typename fcppt::mpl::list::detail::transpose< List >::type
 Transposes n lists of length k into k lists of length n.If.
 
template<fcppt::mpl::map::object_concept Map, typename Key >
using fcppt::mpl::map::at = typename fcppt::mpl::map::detail::at< Map, Key >::type
 The value type associated with a key in a map.Let Map = map::object<element<K_1,V_1>,...,element<K_n,V_n>>, where Key = K_i for some 1 <= i <= n. Then the result is V_i.
 
template<fcppt::mpl::map::element_concept Element>
using fcppt::mpl::map::element_key = typename fcppt::mpl::map::detail::element_key< Element >::type
 The key type of an element.Returns K if Element=map::element<K,V>.
 
template<fcppt::mpl::map::element_concept Element>
using fcppt::mpl::map::element_value = typename fcppt::mpl::map::detail::element_value< Element >::type
 The value type of an element.Returns V if Element=map::element<K,V>.
 
template<fcppt::mpl::map::object_concept Map1, fcppt::mpl::map::object_concept Map2>
using fcppt::mpl::map::equal = fcppt::mpl::apply< fcppt::mpl::if_< fcppt::mpl::set::equal< fcppt::mpl::map::keys< Map1 >, fcppt::mpl::map::keys< Map2 > >, fcppt::mpl::bind< fcppt::mpl::lambda< fcppt::mpl::map::detail::equal_impl::map_same_values >, fcppt::mpl::constant< Map1 >, fcppt::mpl::constant< Map2 > >, fcppt::mpl::constant< std::false_type > > >
 Checks if two maps are equal.
 
template<fcppt::mpl::map::object_concept Map>
using fcppt::mpl::map::flip = typename fcppt::mpl::map::detail::flip< Map >::type
 Flips the key-value pairs inside a map.Let Map=map::object<element<K_1,V_1>,...,element<K_n,V_n>>. Then the result is.
 
template<fcppt::mpl::map::object_concept Map, typename Key >
using fcppt::mpl::map::has_key = typename fcppt::mpl::map::detail::has_key< Map, Key >::type
 Checks if a map contains a key.Let Map = map::object<element<K_1,V_1>,...,element<K_n,V_n>>. If Key = K_i for some 1 <= i <= n, then the result is std::true_type. Otherwise, it is std::false_type.
 
template<fcppt::mpl::map::object_concept Map, typename Key , typename Value >
using fcppt::mpl::map::insert = typename fcppt::mpl::map::detail::insert< Map, Key, Value >::type
 Inserts a new element into a map.Let Map = map::object<element<K_1,V_1>,...,element<K_n,V_n>>. Then the result is.
 
template<typename T >
using fcppt::mpl::map::is_element = typename fcppt::mpl::map::detail::is_element< T >::type
 Checks if a type is a map element.T is a map element if an only if it is of the form fcppt::mpl::map::element<K,V> for some types K, V.
 
template<typename T >
using fcppt::mpl::map::is_object = typename fcppt::mpl::map::detail::is_object< T >::type
 Checks if a type is a map.
 
template<fcppt::mpl::map::object_concept Map>
using fcppt::mpl::map::keys = typename fcppt::mpl::map::detail::keys< Map >::type
 They keys of a map as a set.Let Map = map::object<element<K_1,V_1>,...,element<K_n,V_n>>. Then the result is.
 
template<fcppt::mpl::map::element_concept... Args>
using fcppt::mpl::map::keys_unique = fcppt::mpl::list::distinct< fcppt::mpl::list::object< fcppt::mpl::map::element_key< Args >... > >
 Checks if the keys of elements are pairwise disjoint.Let Args=element<K_1,V_1>,...,element<K_n,V_n>. The result is std::true_type if all the keys K_1,...,K_n are pairwise disjoint. Otherwise, it is std::false_type.
 
template<fcppt::mpl::integral_concept T1, fcppt::mpl::integral_concept T2>
using fcppt::mpl::mul = typename fcppt::mpl::detail::mul< T1, T2 >::type
 Multiplies two integral constants.Let T1 = std::integral_constant<T,V_1> and T2 = std::integral_constant<T,V_2>. Then the result is std::integral_constant<T,V_1 * V_2>.
 
template<fcppt::mpl::set::object_concept Set, typename Key >
using fcppt::mpl::set::contains = typename fcppt::mpl::set::detail::contains< Set, Key >::type
 Checks if a set contains an element.Let Set = set::object<E_1,...,E_n>. The result is std::true_type if Key = E_i for some 1 <= i <= n. Otherwise, it is std::false_type.
 
template<fcppt::mpl::set::object_concept Set1, fcppt::mpl::set::object_concept Set2>
using fcppt::mpl::set::difference = fcppt::mpl::list::fold< fcppt::mpl::set::to_list< Set1 >, fcppt::mpl::bind< fcppt::mpl::lambda< fcppt::mpl::if_ >, fcppt::mpl::bind< fcppt::mpl::lambda< fcppt::mpl::set::contains >, fcppt::mpl::constant< Set2 >, fcppt::mpl::arg< 1 > >, fcppt::mpl::arg< 2 >, fcppt::mpl::bind< fcppt::mpl::lambda< fcppt::mpl::set::insert >, fcppt::mpl::arg< 2 >, fcppt::mpl::arg< 1 > > >, fcppt::mpl::set::object<> >
 The difference of two sets.The result contains every element that is in Set1, but not in Set2.
 
template<fcppt::mpl::set::object_concept Set1, fcppt::mpl::set::object_concept Set2>
using fcppt::mpl::set::equal = std::is_same< fcppt::mpl::set::symmetric_difference< Set1, Set2 >, fcppt::mpl::set::object<> >
 Checks if two sets are equal.
 
template<fcppt::mpl::list::object_concept List>
using fcppt::mpl::set::from_list = typename fcppt::mpl::set::detail::from_list< List >::type
 Converts a list with no duplicates into a set.Let List = list::object<L_1,...,L_n>, where L_1,...,L_n are pairwise disjoint. The result is.
 
template<fcppt::mpl::list::object_concept List>
using fcppt::mpl::set::from_list_relaxed = fcppt::mpl::list::fold< List, fcppt::mpl::bind< fcppt::mpl::lambda< fcppt::mpl::set::insert_relaxed >, fcppt::mpl::arg< 2 >, fcppt::mpl::arg< 1 > >, fcppt::mpl::set::object<> >
 Converts a list with into a set, removing duplicates.Unlike fcppt::mpl::set::from_list, this function allows duplicate elements.
 
template<fcppt::mpl::set::object_concept Set, typename E >
using fcppt::mpl::set::insert = typename fcppt::mpl::set::detail::insert< Set, E >::type
 Inserts a new element into a set.Let Set = set::object<E_1,...,E_n>. Then the result is.
 
template<fcppt::mpl::set::object_concept Set, typename Value >
using fcppt::mpl::set::insert_relaxed = fcppt::mpl::apply< fcppt::mpl::if_< fcppt::mpl::set::contains< Set, Value >, fcppt::mpl::constant< Set >, fcppt::mpl::bind< fcppt::mpl::lambda< fcppt::mpl::set::insert >, fcppt::mpl::constant< Set >, fcppt::mpl::constant< Value > > > >
 Inserts an element into a set.Let Set = set::object<E_1,...,E_n>. If E is not equal to any of the E_1,...,E_n, then the result is.
 
template<fcppt::mpl::set::object_concept Set1, fcppt::mpl::set::object_concept Set2>
using fcppt::mpl::set::intersection = fcppt::mpl::list::fold< fcppt::mpl::set::to_list< Set1 >, fcppt::mpl::bind< fcppt::mpl::lambda< fcppt::mpl::if_ >, fcppt::mpl::bind< fcppt::mpl::lambda< fcppt::mpl::set::contains >, fcppt::mpl::constant< Set2 >, fcppt::mpl::arg< 1 > >, fcppt::mpl::bind< fcppt::mpl::lambda< fcppt::mpl::set::insert_relaxed >, fcppt::mpl::arg< 2 >, fcppt::mpl::arg< 1 > >, fcppt::mpl::arg< 2 > >, fcppt::mpl::set::object<> >
 The intersection of two sets.The result contains every element that is both in Set1 and Set2.
 
template<typename T >
using fcppt::mpl::set::is_object = typename fcppt::mpl::set::detail::is_object< T >::type
 Checks if a type is a set.
 
template<fcppt::mpl::set::object_concept Set>
using fcppt::mpl::set::size = fcppt::mpl::list::size< fcppt::mpl::set::to_list< Set > >
 The size of a set.If Set = set::object<L_1,...,L_n> then the result is fcppt::mpl::size_type<n>.
 
template<fcppt::mpl::set::object_concept Set1, fcppt::mpl::set::object_concept Set2>
using fcppt::mpl::set::symmetric_difference = fcppt::mpl::set::union_< fcppt::mpl::set::difference< Set1, Set2 >, fcppt::mpl::set::difference< Set2, Set1 > >
 The symmetric difference of two sets.The result contains every element that is either in Set1 or in Set2, but not in both.
 
template<fcppt::mpl::set::object_concept Set>
using fcppt::mpl::set::to_list = typename fcppt::mpl::set::detail::to_list< Set >::type
 Converts a set to a list.Let Set = set::object<E_1,...,E_n>. The result is.
 
template<fcppt::mpl::set::object_concept Set1, fcppt::mpl::set::object_concept Set2>
using fcppt::mpl::set::union_ = fcppt::mpl::list::fold< fcppt::mpl::set::to_list< Set1 >, fcppt::mpl::bind< fcppt::mpl::lambda< fcppt::mpl::set::insert_relaxed >, fcppt::mpl::arg< 2 >, fcppt::mpl::arg< 1 > >, Set2 >
 The union of two sets.The result contains every element that is in Set1 or in Set2.
 
template<typename... Args>
using fcppt::mpl::set::unique = fcppt::mpl::list::distinct< fcppt::mpl::list::object< Args... > >
 Checks if a variadic list is pairwise disjoint.
 
template<std::size_t I>
using fcppt::mpl::size_type = std::integral_constant< std::size_t, I >
 The size type used by this library.
 

Functions

template<fcppt::mpl::list::object_concept List, typename Function >
void fcppt::mpl::list::for_each_break (Function const &_function)
 Calls a runtime function for each element of a listing, possibly breaking out early.
 
template<fcppt::mpl::list::object_concept List, typename Function , typename FailFunction >
FCPPT_PP_PUSH_WARNING std::invoke_result_t< FailFunction > fcppt::mpl::list::invoke_on (std::size_t const _index, Function const &_function, FailFunction const &_fail_function)
 Applies a function to the nth element of an mpl::list::object with a runtime index.
 
template<typename Ch , typename Traits , typename... Types>
std::basic_ostream< Ch, Traits > & fcppt::mpl::list::operator<< (std::basic_ostream< Ch, Traits > &_stream, fcppt::mpl::list::object< Types... > const &)
 Prints a list.Prints List to _stream. Every type in List will be converted to a string using fcppt::type_name.
 

Variables

template<fcppt::mpl::lambda_concept L, typename... Args>
constexpr bool fcppt::mpl::apply_v = fcppt::mpl::apply<L,Args...>::value
 Calls a lambda.
 
template<typename F , fcppt::mpl::list::object_concept L>
constexpr bool fcppt::mpl::is_invocable_v = fcppt::mpl::is_invocable<F,L>::value
 Checks if a function can be invoked with a given argument list.
 
template<fcppt::mpl::list::object_concept List, fcppt::mpl::lambda_concept L>
constexpr bool fcppt::mpl::list::all_of_v = fcppt::mpl::list::all_of<List,L>::value
 Checks if a predicate holds for all types of a list.
 
template<fcppt::mpl::list::object_concept List, fcppt::mpl::lambda_concept L>
constexpr bool fcppt::mpl::list::any_of_v = fcppt::mpl::list::any_of<List,L>::value
 Checks if a predicate holds for any type of a list.
 
template<fcppt::mpl::lambda_concept L, fcppt::mpl::list::object_concept Args>
constexpr bool fcppt::mpl::list::apply_v = fcppt::mpl::list::apply<L,Args>::value
 Calls a lambda using a list of arguments.
 
template<fcppt::mpl::list::object_concept List, typename E >
constexpr bool fcppt::mpl::list::contains_v = fcppt::mpl::list::contains<List,E>::value
 Checks if a list contains an element.
 
template<fcppt::mpl::list::object_concept List>
constexpr bool fcppt::mpl::list::distinct_v = fcppt::mpl::list::distinct<List>::value
 Checks if all elements of a list are pairwise disjoint.
 
template<fcppt::mpl::list::object_concept List>
constexpr bool fcppt::mpl::list::empty_v = fcppt::mpl::list::empty<List>::value
 Checks if a list is empty.
 
template<fcppt::mpl::map::object_concept Map1, fcppt::mpl::map::object_concept Map2>
constexpr bool fcppt::mpl::map::equal_v = fcppt::mpl::map::equal<Map1,Map2>::value
 Checks if two maps are equal.
 
template<fcppt::mpl::map::object_concept Map, typename Key >
constexpr bool fcppt::mpl::map::has_key_v = fcppt::mpl::map::has_key<Map,Key>::value
 Checks if a map contains a key.
 
template<fcppt::mpl::set::object_concept Set, typename Key >
constexpr bool fcppt::mpl::set::contains_v = fcppt::mpl::set::contains<Set,Key>::value
 Checks if a set contains an element.
 
template<fcppt::mpl::set::object_concept Set1, fcppt::mpl::set::object_concept Set2>
constexpr bool fcppt::mpl::set::equal_v = fcppt::mpl::set::equal<Set1,Set2>::value
 Checks if two sets are equal.
 

Typedef Documentation

◆ add

using fcppt::mpl::add = typedef typename fcppt::mpl::detail::add<T1,T2>::type

Adds two integral constants.Let T1 = std::integral_constant<T,V_1> and T2 = std::integral_constant<T,V_2>. Then the result is std::integral_constant<T,V_1 + V_2>.

◆ all_of

Checks if a predicate holds for all types of a list.If List=list::object<L_1,...,L_n> and L holds a function F of arity 1, then the result is.

std::bool_constant<std::conjunction_v<F<L_1>, ..., F<L_n>>>

TODO(concepts)

◆ any_of

Checks if a predicate holds for any type of a list.If List=list::object<L_1,...,L_n> and L holds a function F of arity 1, then the result is.

std::bool_constant<std::disjunction_v<F<L_1>, ..., F<L_n>>>

TODO(concepts)

◆ append

using fcppt::mpl::list::append = typedef typename fcppt::mpl::list::detail::append<List1,List2>::type

Appends two lists.If List1 = list::object<L_1,...,L_n> and List2 = list::object<R_1,...,R_m> then the result is.

list::object<L_1,...,L_n,R_1,...,R_m>

◆ apply [1/2]

template<fcppt::mpl::lambda_concept L, typename... Args>
using fcppt::mpl::apply = typedef typename fcppt::mpl::detail::apply<L,Args...>::type

Calls a lambda.

If L holds a function F of arity n and Args = A_1,...,A_n, then F<A_1,...,A_n> is returned.

◆ apply [2/2]

using fcppt::mpl::list::apply = typedef typename fcppt::mpl::list::detail::apply<L,Args>::type

Calls a lambda using a list of arguments.

If L holds a function F of arity n and Args = list::object<A_1,...,A_n>, then F<A_1,...,A_n> is returned.

◆ arg

template<std::size_t Arg>
using fcppt::mpl::arg = typedef typename fcppt::mpl::detail::arg<Arg - 1U>::type

A lambda that returns an argument in a specific position.

A lambda that returns the argument in position Arg. Formally, for every integer m >= Arg it is a lambda that holds a function F_m of arity m, such that F_m<T_1,...,T_m> = T_Arg.

Note
Argument counting starts at 1 instead of 0.

◆ at [1/2]

using fcppt::mpl::list::at = typedef typename fcppt::mpl::list::detail::at<List,Index>::type

The element of a list at a given position.If List = list::object<L_1,...,L_n> and Index = fcppt::mpl::size_type<j> with 0 <= j < n then the result is L_{j-1}.

◆ at [2/2]

template<fcppt::mpl::map::object_concept Map, typename Key >
using fcppt::mpl::map::at = typedef typename fcppt::mpl::map::detail::at<Map,Key>::type

The value type associated with a key in a map.Let Map = map::object<element<K_1,V_1>,...,element<K_n,V_n>>, where Key = K_i for some 1 <= i <= n. Then the result is V_i.

◆ back

The last element of a list.If List = list::object<L_1,...,L_n> then the result is L_n.

◆ bind

using fcppt::mpl::bind = typedef typename fcppt::mpl::detail::bind<L,Ls...>::type

Function composition on multiple lambdas.

Suppose that L holds a function G and Ls... hold functions Gs..., then bind<L,Ls...> is a lambda that when called with arguments Args... it returns

G<Gs<Args...>...>

Formally, let G be of arity k and Gs... = G_1, ..., G_k be of arity m. Then fcppt::mpl::bind<L,L_1,...,L_k> holds a function F of arity m, such that F<T_1,...,T_m> = G<G_1<T_1,...,T_m>,...,G_k<T_1,...,T_m>>.

◆ constant

template<typename T >
using fcppt::mpl::constant = typedef typename fcppt::mpl::detail::constant<T>::type

The constant lambda.

This is a lambda that returns T.

Formally, for every integer m it holds a function F_m of arity m, such that F_m<T_1,...,T_m> = C.

◆ contains [1/2]

template<fcppt::mpl::list::object_concept List, typename E >
using fcppt::mpl::list::contains = typedef fcppt::mpl::list::any_of< List, fcppt::mpl:: bind<fcppt::mpl::lambda<std::is_same>, fcppt::mpl::arg<1>, fcppt::mpl::constant<E> >>

Checks if a list contains an element.Let List = list::object<L_1,...,L_n>. The result is std::true_type if E = L_i for some 1 <= i <= n. Otherwise, it is std::false_type.

◆ contains [2/2]

template<fcppt::mpl::set::object_concept Set, typename Key >
using fcppt::mpl::set::contains = typedef typename fcppt::mpl::set::detail::contains<Set,Key>::type

Checks if a set contains an element.Let Set = set::object<E_1,...,E_n>. The result is std::true_type if Key = E_i for some 1 <= i <= n. Otherwise, it is std::false_type.

◆ dec

using fcppt::mpl::dec = typedef typename fcppt::mpl::detail::dec<T>::type

Subtracts one from an integral constant.Let T = std::integral_constant<U,V>. Then the result is std::integral_constant<U,V-->.

◆ difference

The difference of two sets.The result contains every element that is in Set1, but not in Set2.

◆ distinct

using fcppt::mpl::list::distinct = typedef typename fcppt::mpl::list::detail::distinct<List>::type

Checks if all elements of a list are pairwise disjoint.Let List = list::object<L_1,...,L_n>. If L_i != L_j for all 1 <= i != j <= n then the result is std::true_type. Otherwise, it is std::false_type.

◆ drop

Removes some elements of a list from the beginning.If List = list::object<L_1,...,L_n> then the result is.

list::object<L_{S+1},...,L_n>

◆ element_key

using fcppt::mpl::map::element_key = typedef typename fcppt::mpl::map::detail::element_key<Element>::type

The key type of an element.Returns K if Element=map::element<K,V>.

◆ element_value

using fcppt::mpl::map::element_value = typedef typename fcppt::mpl::map::detail::element_value<Element>::type

The value type of an element.Returns V if Element=map::element<K,V>.

◆ empty

Checks if a list is empty.Let List = list::object<L_1,...,L_n>. If n = 0 then std::true_type is returned. Otherwise, std::false_typeis returned.

◆ equal [1/2]

Checks if two maps are equal.

Two maps are equal if and only if they contain the same key-value pairs. Let Map1=map::object<element<K_1,V_1>,...,element<K_n,V_n>> and Map2=map::object<element<K_1',V_1'>,...,element<K_m',V_m'>>. Then the result is std::true_type if

{(K_1,V_1),...,(K_n,V_n)} = {(K_1',V_1'),...,(K_m',V_m')}

Otherwise, the result is std::false_type.

◆ equal [2/2]

Checks if two sets are equal.

Two sets are equal if and only if they contain the same elements. Let Set1=set::object<E_1,...,E_n> and Set2=set::object<E_1',...,E_m'>>. Then the result is std::true_type if

{E_1,...,E_n} = {E_1',...,E_m'}

Otherwise, the result is std::false_type.

◆ flip

using fcppt::mpl::map::flip = typedef typename fcppt::mpl::map::detail::flip<Map>::type

Flips the key-value pairs inside a map.Let Map=map::object<element<K_1,V_1>,...,element<K_n,V_n>>. Then the result is.

This only works if all the values V_1,...,V_n are pairwise disjoint.

◆ fold

using fcppt::mpl::list::fold = typedef typename fcppt::mpl::list::detail::fold<List,L,V>::type

Folds a list.

Let List = list::object<L_1,...,L_n> and L hold a function F of arity 2. Let V_i = F<L_{i+1},V_{i+1}> for 0 <= i < n and V_n = V. Then the result is V_0. The calculations are

V_0 = F<L_1,V_1>
V_1 = F<L_2,V_2>
...
V_{n-1} = F<L_n,V_n>
V_n = V

Notice that if n=0 then V_0 = V.

◆ from

template<typename Type >
using fcppt::mpl::list::from = typedef typename fcppt::mpl::list::detail::from<Type>::type

Converts a template type to a list.If Type = T<L_1, ..., L_n> then the result is list::object<L_1,...,L_n>.

◆ from_list

using fcppt::mpl::set::from_list = typedef typename fcppt::mpl::set::detail::from_list<List>::type

Converts a list with no duplicates into a set.Let List = list::object<L_1,...,L_n>, where L_1,...,L_n are pairwise disjoint. The result is.

set::object<L_1,...,L_n>

◆ from_list_relaxed

Converts a list with into a set, removing duplicates.Unlike fcppt::mpl::set::from_list, this function allows duplicate elements.

◆ front

using fcppt::mpl::list::front = typedef typename fcppt::mpl::list::detail::front<List>::type

The first element of a list.If List = list::object<L_1,...,L_n> then the result is L_1.

◆ function_args

template<typename Function >
using fcppt::mpl::function_args = typedef typename fcppt::mpl::detail::function_args<Function>::type

The argument types of a function as a list.

Template Parameters
FunctionMust be a function type.

TODO(concepts)

◆ greater

using fcppt::mpl::greater = typedef typename fcppt::mpl::detail::greater<T1,T2>::type

Checks if one integral constant is greater than another.Let T1 = std::integral_constant<T,V_1> and T2 = std::integral_constant<T,V_2>. Then the result is std::bool_constant<(V1 > V2)>.

◆ has_key

template<fcppt::mpl::map::object_concept Map, typename Key >
using fcppt::mpl::map::has_key = typedef typename fcppt::mpl::map::detail::has_key<Map,Key>::type

Checks if a map contains a key.Let Map = map::object<element<K_1,V_1>,...,element<K_n,V_n>>. If Key = K_i for some 1 <= i <= n, then the result is std::true_type. Otherwise, it is std::false_type.

◆ if_

template<fcppt::mpl::bool_concept B, typename T , typename F >
using fcppt::mpl::if_ = typedef std::conditional_t<B::value, T, F>

The if-then-else function.Similar to std::conditional_t but takes a bool_concept, i.e., a std::bool_constant<V> for any bool V instead of V directly.

◆ index_of

template<fcppt::mpl::list::object_concept List, typename E >
using fcppt::mpl::list::index_of = typedef fcppt::mpl::list::index_of_if< List, fcppt::mpl:: bind<fcppt::mpl::lambda<std::is_same>, fcppt::mpl::constant<E>, fcppt::mpl::arg<1> >>

The first index of a given element inside a list.Let List = list::object<L_1,...,L_n>. Returns size_type<Index> where Index is the smallest number such that L_{Index} = E.

◆ index_of_if

using fcppt::mpl::list::index_of_if = typedef typename fcppt::mpl::list::detail::index_of_if<List,L,fcppt::mpl::size_type<0U> >::type

The first index where an element matches a predicate inside a list.Let List = list::object<L_1,...,L_n> and let L hold a function F of arity 1. Returns size_type<Index> where Index is the smallest number such that F<L_{Index}> = std::true_type.

◆ indices

Returns the positions of a list.If List = list::object<L_1,...,L_n> then the result is.

◆ insert [1/2]

template<fcppt::mpl::map::object_concept Map, typename Key , typename Value >
using fcppt::mpl::map::insert = typedef typename fcppt::mpl::map::detail::insert<Map,Key,Value>::type

Inserts a new element into a map.Let Map = map::object<element<K_1,V_1>,...,element<K_n,V_n>>. Then the result is.

This only works if Key is not equal to any of the K_1,...,K_n.

◆ insert [2/2]

template<fcppt::mpl::set::object_concept Set, typename E >
using fcppt::mpl::set::insert = typedef typename fcppt::mpl::set::detail::insert<Set,E>::type

Inserts a new element into a set.Let Set = set::object<E_1,...,E_n>. Then the result is.

set::object<E_1,...,E_n,E>

This only works if E is not equal to any of the E_1,...,E_n.

◆ insert_relaxed

Inserts an element into a set.Let Set = set::object<E_1,...,E_n>. If E is not equal to any of the E_1,...,E_n, then the result is.

set::object<E_1,...,E_n,E>

Otherwise, the result is Set.

◆ intersection

The intersection of two sets.The result contains every element that is both in Set1 and Set2.

◆ interval

using fcppt::mpl::list::interval = typedef typename fcppt::mpl::list::detail::interval< std::make_integer_sequence<fcppt::type_traits::value_type<Begin>, End::value - Begin::value>, Begin>::type

Return the interval between two numbers.If Begin = std::integral_constant<Type,B> and End = std::integral_constant<Type,E> then the result is.

list::object<std::integral_constant<Type,B>, std::integral_constant<Type,B+1>,...,std::integral_constant<Type,E-1>>
Note
End is not included in the range but Begin is.

◆ is_element

template<typename T >
using fcppt::mpl::map::is_element = typedef typename fcppt::mpl::map::detail::is_element<T>::type

Checks if a type is a map element.T is a map element if an only if it is of the form fcppt::mpl::map::element<K,V> for some types K, V.

◆ is_invocable

template<typename F , fcppt::mpl::list::object_concept L>
using fcppt::mpl::is_invocable = typedef fcppt::mpl::list:: apply<fcppt::mpl::lambda<std::is_invocable>, fcppt::mpl::list::push_front<L, F> >

Checks if a function can be invoked with a given argument list.Checks if function F can be invoked with the types in L, i.e. if L = list::object<L_1,...,L_n>, then the result is.

std::is_invocable<F,L_1,...,L_n>

◆ is_lambda

template<typename T >
using fcppt::mpl::is_lambda = typedef typename fcppt::mpl::detail::is_lambda<T>::type

Checks if a type is a lambda.

T is a lambda if an only if it is of the form fcppt::mpl::lambda<F> for some type F.

◆ is_object [1/3]

template<typename T >
using fcppt::mpl::list::is_object = typedef typename fcppt::mpl::list::detail::is_object<T>::type

Checks if a type is a list.

T is a list if an only if it is of the form fcppt::mpl::list::object<T_1, ..., T_n> for some types T_1, ..., T_n.

◆ is_object [2/3]

template<typename T >
using fcppt::mpl::map::is_object = typedef typename fcppt::mpl::map::detail::is_object<T>::type

Checks if a type is a map.

T is a map if an only if it is of the form fcppt::mpl::map::object<E_1, ..., E_n> for some elements E_1, ..., E_n.

◆ is_object [3/3]

template<typename T >
using fcppt::mpl::set::is_object = typedef typename fcppt::mpl::set::detail::is_object<T>::type

Checks if a type is a set.

T is a set if an only if it is of the form fcppt::mpl::set::object<T_1, ..., T_n> for some types T_1, ..., T_n.

◆ is_size_type

template<typename T >
using fcppt::mpl::is_size_type = typedef typename fcppt::mpl::detail::is_size_type<T>::type

Checks if a type is a size_type.T is a size type if and only if it is of the form fcppt::mpl::size_type<N> for some std::size_t N.

◆ join

Joins a list of lists.If List = list::object<L_1,...,L_n> and L_1, ..., L_n are lists, then the result is.

append<L_1,append<L_2,...,append<L_{n-1},L_n> ...>>
Template Parameters
ListMust be a list of lists. TODO(concepts)

◆ keep_if

Only keeps elements that satisfy a predicate.Keeps the elements of List for which Pred is std::true_type. The order of the elements stays the same.

◆ keys

using fcppt::mpl::map::keys = typedef typename fcppt::mpl::map::detail::keys<Map>::type

They keys of a map as a set.Let Map = map::object<element<K_1,V_1>,...,element<K_n,V_n>>. Then the result is.

set::object<K_1,...,K_n>

◆ keys_unique

template<fcppt::mpl::map::element_concept... Args>
using fcppt::mpl::map::keys_unique = typedef fcppt::mpl::list::distinct<fcppt::mpl::list::object<fcppt::mpl::map::element_key<Args>...> >

Checks if the keys of elements are pairwise disjoint.Let Args=element<K_1,V_1>,...,element<K_n,V_n>. The result is std::true_type if all the keys K_1,...,K_n are pairwise disjoint. Otherwise, it is std::false_type.

◆ less

using fcppt::mpl::less = typedef typename fcppt::mpl::detail::less<T1, T2>::type

Checks if one integral constant is less than another.Let T1 = std::integral_constant<T,V_1> and T2 = std::integral_constant<T,V_2>. Then the result is std::bool_constant<(V1 < V2)>.

◆ map

using fcppt::mpl::list::map = typedef typename fcppt::mpl::list::detail::map<List,F>::type

Applies a lambda to every element of a list.If List=list::object<L_1,...,L_n> and L holds a function F of arity 1, then the result is.

◆ map_multi

Applies an n-ary lambda to every element-tuple of n lists.If Lists=list::object<L_{1,1},...,L_{1,k}>, ... list::object<L_{1,n},...,L_{n,k}> and L holds a function F of arity n, then the result is.

list::object<F<L_{1,1},...,L_{1,n}>,...,F<L_{1,k},...,L_{n,k}>>
Template Parameters
ListsMust all have the same size. TODO(concepts)

◆ maximum

Calculates the maximum value of a list.

Template Parameters
SequenceA non empty mpl::list::object of std::integral_constants. TODO(concepts)

◆ mul

using fcppt::mpl::mul = typedef typename fcppt::mpl::detail::mul<T1,T2>::type

Multiplies two integral constants.Let T1 = std::integral_constant<T,V_1> and T2 = std::integral_constant<T,V_2>. Then the result is std::integral_constant<T,V_1 * V_2>.

◆ pop_back

using fcppt::mpl::list::pop_back = typedef typename fcppt::mpl::list::detail::pop_back<fcppt::mpl::list::object<>,List>::type

Removes the last element of a list.If List = list::object<L_1,...,L_n>, where n >= 1, then the result is.

list::object<L_1,...,L_{n-1}>

◆ push_back

template<fcppt::mpl::list::object_concept List, typename T >
using fcppt::mpl::list::push_back = typedef typename fcppt::mpl::list::detail::push_back<List,T>::type

Adds an element to the back of a list.If List = list::object<L_1,...,L_n>, then the result is.

list::object<L_1,...,L_n,T>

◆ push_front

template<fcppt::mpl::list::object_concept List, typename T >
using fcppt::mpl::list::push_front = typedef typename fcppt::mpl::list::detail::push_front<List,T>::type

Adds an element to the front of a list.If List = list::object<L_1,...,L_n>, then the result is.

list::object<T,L_1,...,L_n>

◆ remove

template<fcppt::mpl::list::object_concept List, typename T >
using fcppt::mpl::list::remove = typedef fcppt::mpl::list::remove_if< List, fcppt::mpl:: bind<fcppt::mpl::lambda<std::is_same>, fcppt::mpl::constant<T>, fcppt::mpl::arg<1> >>

Removes a specific type from a list.Removes every occurrence of T from List. The order of the remaining elements stays the same.

◆ remove_if

Removes the elements that satisfy a predicate.Removes the elements of List for which Pred is std::true_type. The order of the remaining elements stays the same.

◆ repeat

Creates a list that consists of n elements that are all the same.Let S = fcppt::mpl::size_type<n>. Then the result is.

list::object<T_1,...,T_n>

where T_1 = ... = T_n = T.

◆ size [1/2]

using fcppt::mpl::list::size = typedef typename fcppt::mpl::list::detail::size<List>::type

The size of a list.If List = list::object<L_1,...,L_n> then the result is fcppt::mpl::size_type<n>.

◆ size [2/2]

The size of a set.If Set = set::object<L_1,...,L_n> then the result is fcppt::mpl::size_type<n>.

◆ size_type

template<std::size_t I>
using fcppt::mpl::size_type = typedef std::integral_constant<std::size_t,I>

The size type used by this library.

◆ symmetric_difference

The symmetric difference of two sets.The result contains every element that is either in Set1 or in Set2, but not in both.

◆ tail

using fcppt::mpl::list::tail = typedef typename fcppt::mpl::list::detail::tail<List>::type

Removes the first element of a list.If List = list::object<L_1,...,L_n>, where n >= 1, then the result is.

list::object<L_2,...,L_n>

◆ take

using fcppt::mpl::list::take = typedef typename fcppt::mpl::list::detail::take<List,std::make_index_sequence<S::value> >::type

Keeps some elements of a list from the beginning.If List = list::object<L_1,...,L_n> then the result is.

list::object<L_1,...,L_S>

◆ to_list

using fcppt::mpl::set::to_list = typedef typename fcppt::mpl::set::detail::to_list<Set>::type

Converts a set to a list.Let Set = set::object<E_1,...,E_n>. The result is.

list::object<E_1,...,E_n>

◆ transpose

using fcppt::mpl::list::transpose = typedef typename fcppt::mpl::list::detail::transpose<List>::type

Transposes n lists of length k into k lists of length n.If.

List=list::object<list::object<L_{1,1},...,L_{1,k}>, ... list::object<L_{1,n},...,L_{n,k}>>

then the result is

list::object<list::object<L_{1,1},...,L_{1,n}>,...,list::object<L_{1,k},...,L_{n,k}>>

TODO(concepts)

◆ union_

The union of two sets.The result contains every element that is in Set1 or in Set2.

◆ unique

template<typename... Args>
using fcppt::mpl::set::unique = typedef fcppt::mpl::list::distinct<fcppt::mpl::list::object<Args...> >

Checks if a variadic list is pairwise disjoint.

Function Documentation

◆ for_each_break()

template<fcppt::mpl::list::object_concept List, typename Function >
void fcppt::mpl::list::for_each_break ( Function const &  _function)
inline

Calls a runtime function for each element of a listing, possibly breaking out early.

Let List = list::object<L_1,...,L_n>. Calls r_1 = _function(fcppt::tag<L_1>{}). If r_1 == fcppt::loop::break_, the algorithm stops. If r_1 == fcppt::loop::continue_, then r_2 = _function(fcppt::tag<L_2>{}) and so on, up to r_n = _function(fcppt::tag<L_n>{}).

TODO(concepts)

◆ invoke_on()

template<fcppt::mpl::list::object_concept List, typename Function , typename FailFunction >
FCPPT_PP_PUSH_WARNING std::invoke_result_t< FailFunction > fcppt::mpl::list::invoke_on ( std::size_t const  _index,
Function const &  _function,
FailFunction const &  _fail_function 
)

Applies a function to the nth element of an mpl::list::object with a runtime index.

Let List = list::object<L_1,...,L_n>. If _index < n the result is _function(fcppt::tag<L_i>{}). Otherwise, the result is _fail_function().

// In the following example, we are going to create a function that can
// transform a color type given at runtime (defined via an enum) into a static
// color type (represented by variant over static color types).
#include <fcppt/tag.hpp>
#include <fcppt/cast/enum_to_underlying.hpp>
#include <fcppt/cast/to_unsigned.hpp>
#include <fcppt/mpl/list/invoke_on.hpp>
#include <fcppt/mpl/list/object.hpp>
#include <fcppt/variant/from_list.hpp>
#include <fcppt/variant/holds_type.hpp>
#include <fcppt/config/external_begin.hpp>
#include <exception>
#include <iostream>
#include <fcppt/config/external_end.hpp>
namespace
{
// Our color enum
enum class color_enum
{
bgr,
rgb
// + more color types
};
// Our static color types
struct bgr
{
};
struct rgb
{
};
// Typedef the available static color types
using static_color_types = fcppt::mpl::list::object<bgr, rgb>;
// The variant type that can hold any of the static color types
// Transforms a concrete color type into a color_variant. This function will be
// used with invoke_on.
struct create_function
{
template <typename ConcreteColor>
color_variant operator()(fcppt::tag<ConcreteColor>) const
{
return color_variant(ConcreteColor());
}
};
// Transforms a color enum into a static color type using invoke_on
color_variant make_color_variant(color_enum const _value)
{
return fcppt::mpl::list::invoke_on<static_color_types>(
create_function(),
[]() -> color_variant { std::terminate(); });
}
}
int main()
{
color_variant const variant(make_color_variant(color_enum::rgb));
// variant now holds the type rgb
std::cout << fcppt::variant::holds_type<rgb>(variant) << '\n';
}
Template Parameters
FunctionMust be callable as R fcppt::tag<T>() for every T in List , where R is the result type.
FailFunctionMust be a callable as R (), where R is the result tye.

TODO(concepts)

◆ operator<<()

template<typename Ch , typename Traits , typename... Types>
std::basic_ostream< Ch, Traits > & fcppt::mpl::list::operator<< ( std::basic_ostream< Ch, Traits > &  _stream,
fcppt::mpl::list::object< Types... > const &   
)

Prints a list.Prints List to _stream. Every type in List will be converted to a string using fcppt::type_name.

Variable Documentation

◆ all_of_v

constexpr bool fcppt::mpl::list::all_of_v = fcppt::mpl::list::all_of<List,L>::value
inlineconstexpr

Checks if a predicate holds for all types of a list.

See also
fcppt::mpl::list::all_of

◆ any_of_v

constexpr bool fcppt::mpl::list::any_of_v = fcppt::mpl::list::any_of<List,L>::value
inlineconstexpr

Checks if a predicate holds for any type of a list.

See also
fcppt::mpl::list::any_of

◆ apply_v [1/2]

template<fcppt::mpl::lambda_concept L, typename... Args>
constexpr bool fcppt::mpl::apply_v = fcppt::mpl::apply<L,Args...>::value
inlineconstexpr

Calls a lambda.

See also
fcppt::mpl::apply

◆ apply_v [2/2]

constexpr bool fcppt::mpl::list::apply_v = fcppt::mpl::list::apply<L,Args>::value
inlineconstexpr

Calls a lambda using a list of arguments.

See also
fcppt::mpl::list::apply

◆ contains_v [1/2]

template<fcppt::mpl::list::object_concept List, typename E >
constexpr bool fcppt::mpl::list::contains_v = fcppt::mpl::list::contains<List,E>::value
inlineconstexpr

Checks if a list contains an element.

See also
fcppt::mpl::list::contains

◆ contains_v [2/2]

template<fcppt::mpl::set::object_concept Set, typename Key >
constexpr bool fcppt::mpl::set::contains_v = fcppt::mpl::set::contains<Set,Key>::value
inlineconstexpr

Checks if a set contains an element.

See also
fcppt::mpl::set::contains

◆ distinct_v

constexpr bool fcppt::mpl::list::distinct_v = fcppt::mpl::list::distinct<List>::value
inlineconstexpr

Checks if all elements of a list are pairwise disjoint.

See also
fcppt::mpl::list::distinct

◆ empty_v

constexpr bool fcppt::mpl::list::empty_v = fcppt::mpl::list::empty<List>::value
inlineconstexpr

Checks if a list is empty.

See also
fcppt::mpl::list::empty

◆ equal_v [1/2]

constexpr bool fcppt::mpl::map::equal_v = fcppt::mpl::map::equal<Map1,Map2>::value
inlineconstexpr

Checks if two maps are equal.

See also
fcppt::mpl::map::equal

◆ equal_v [2/2]

constexpr bool fcppt::mpl::set::equal_v = fcppt::mpl::set::equal<Set1,Set2>::value
inlineconstexpr

Checks if two sets are equal.

See also
fcppt::mpl::set::equal

◆ has_key_v

template<fcppt::mpl::map::object_concept Map, typename Key >
constexpr bool fcppt::mpl::map::has_key_v = fcppt::mpl::map::has_key<Map,Key>::value
inlineconstexpr

Checks if a map contains a key.

See also
fcppt::mpl::map::has_key

◆ is_invocable_v

template<typename F , fcppt::mpl::list::object_concept L>
constexpr bool fcppt::mpl::is_invocable_v = fcppt::mpl::is_invocable<F,L>::value
inlineconstexpr

Checks if a function can be invoked with a given argument list.

See also
fcppt::mpl::is_invocable