![]() |
Home | Libraries | People | FAQ | More |
Copyright © 2015-2017 Peter Dimov
Distributed under the Boost Software License, Version 1.0.
Table of Contents
<boost/mp11/integral.hpp><boost/mp11/list.hpp><boost/mp11/utility.hpp><boost/mp11/algorithm.hpp>mp_assign<L1, L2>mp_clear<L>mp_transform<F, L...>mp_transform_if<P, F, L>mp_fill<L, V>mp_count<L, V>mp_count_if<L, P>mp_contains<L, V>mp_repeat_c<L, N>mp_repeat<L, N>mp_product<F, L...>mp_drop_c<L, N>mp_drop<L, N>mp_iota_c<L, N>mp_iota<L, N>mp_at_c<L, I>mp_at<L,
I>mp_take_c<L, N>mp_take<L, N>mp_replace<L, V, W>mp_replace_if<L, P, W>mp_copy_if<L, P>mp_remove<L, V>mp_remove_if<L, P>mp_partition<L, P>mp_sort<L, P>mp_find_index<L, V>mp_find_index_if<L, P>mp_find<L, V>mp_find_if<L, P>mp_reverse<L>mp_fold<L, V, F>mp_reverse_fold<L, V, F>mp_unique<L>mp_all_of<L, P>mp_none_of<L, P>mp_any_of<L, P><boost/mp11/set.hpp><boost/mp11/map.hpp>...
template<bool B> using mp_bool = std::integral_constant<bool, B>;
using mp_true = mp_bool<true>;
using mp_false = mp_bool<false>;
template<class T> using mp_to_bool = mp_bool<static_cast<bool>(T::value)>;
template<class T> using mp_not = mp_bool< !T::value >;
template<int I> using mp_int = std::integral_constant<int, I>;
template<std::size_t N> using mp_size_t = std::integral_constant<std::size_t, N>;
template<class... T> struct mp_list {};
mp_list is the standard
list type of Mp11, although the library is not restricted to it and can
operate on arbitrary class templates such as std::tuple
or std::variant. Even std::pair
can be used if the transformation does not alter the number of the elements
in the list.
template<class L> using mp_size = /*...*/;
mp_size<L>
returns the number of elements in the list L,
as a mp_size_t. In other
words, mp_size<L<T...>>
is an alias for mp_size_t<sizeof...(T)>.
template<class L> using mp_empty = mp_bool<mp_size<L>::value == 0>;
mp_empty<L>
is an alias for mp_true
if the list L is empty,
for mp_false otherwise.
template<class L> using mp_front = /*...*/;
mp_front<L>
is the first element of the list L.
That is, mp_front<L<T1, T...>>
is an alias for T1.
template<class L> using mp_pop_front = /*...*/;
mp_pop_front<L>
removes the first element of the list L.
That is, mp_pop_front<L<T1, T...>>
is an alias for L<T...>.
template<class L> using mp_rest = mp_pop_front<L>;
mp_rest is another name
for mp_pop_front.
template<class L> using mp_second = /*...*/;
mp_second<L>
is the second element of the list L.
That is, mp_second<L<T1, T2, T...>>
is an alias for T2.
template<class L> using mp_third = /*...*/;
mp_third<L>
is the third element of the list L.
That is, mp_third<L<T1, T2, T3, T...>>
is an alias for T3.
template<class L, class... T> using mp_push_front = /*...*/;
mp_push_front<L, T...> inserts the elements T...
at the front of the list L.
That is, mp_push_front<L<U...>, T...> is an alias for L<T..., U...>.
template<class L, class... T> using mp_push_back = /*...*/;
mp_push_back<L, T...> inserts the elements T...
at the back of the list L.
That is, mp_push_back<L<U...>, T...>
is an alias for L<U..., T...>.
template<class L, template<class...> class Y> using mp_rename = /*...*/;
mp_rename<L, Y> changes the type of the list L to Y.
That is, mp_rename<L<T...>, Y>
is an alias for Y<T...>.
template<class... L> using mp_append = /*...*/;
mp_append<L...>
concatenates the lists in L... into a single list that has the same
type as the first list. mp_append<> is an alias for mp_list<>. mp_append<L1<T1...>, L2<T2...>, ...,
Ln<Tn...>>
is an alias for L1<T1..., T2..., ..., Tn...>.
template<class T> struct mp_identity { using type = T; };
template<class T> using mp_identity_t = T;
template<class... T> struct mp_inherit: T... {};
template<bool C, class T, class E> using mp_if_c = /*...*/;
mp_if_c<B, T, E>
is an alias for T when
B is true,
for E otherwise.
template<class C, class T, class E> using mp_if = mp_if_c<static_cast<bool>(C::value), T, E>;
mp_if<C, T, E>
is an alias for T when
C::value is true,
for E otherwise.
template<bool C, class T, template<class...> class F, class... U> using mp_eval_if_c = /*...*/;
mp_eval_if_c<B, T, F,
U...>
is an alias for T when
B is true,
for F<U...>
otherwise. Its purpose is to avoid evaluating F<U...> when the condition is true as it may not be valid in this case.
template<class C, class T, template<class...> class F, class... U> using mp_eval_if = mp_eval_if_c<static_cast<bool>(C::value), T, F, U...>;
Like mp_eval_if_c, but
the first argument is a type.
template<template<class...> class F, class... T> using mp_valid = /*...*/;
mp_valid<F, T...> is an alias for mp_true
when F<T...>
is a valid expression, for mp_false
otherwise.
template<template<class...> class F, class... T> using mp_defer = /*...*/;
When mp_valid<F, T...> is mp_true,
mp_defer<F, T...> is a struct with a nested type
type which is an alias
for F<T...>.
Otherwise, mp_defer<F, T...> is an empty struct.
template<template<class...> class F, class... T> struct mp_quote { template<class... U> using apply = F<T..., U...>; };
mp_quote<F, T...> transforms the template F into a type. In the common case mp_quote<F>,
the nested template apply
of the result is an alias for F;
otherwise, apply<U...>
is an alias for F<T..., U...>,
allowing partial application.
template<class Q, class... T> using mp_unquote = typename Q::template apply<T...>;
mp_unquote<Q, T...> evaluates the nested template apply of a quoted metafunction. mp_unquote<mp_quote<F>, T...>
is an alias for F<T...>.
mp_unquote<mp_quote<F, T...>, U...> is an alias for F<T..., U...>.
template<class L1, class L2> using mp_assign = /*...*/;
template<class L> using mp_clear = mp_assign<L, mp_list<>>;
template<template<class...> class F, class... L> using mp_transform = /*...*/;
template<template<class...> class P, template<class...> class F, class L> using mp_transform_if = /*...*/;
template<class L, class V> using mp_fill = /*...*/;
template<class L, class V> using mp_count = /*...*/;
template<class L, template<class...> class P> using mp_count_if = /*...*/;
template<class L, class V> using mp_contains = mp_to_bool<mp_count<L, V>>;
template<class L, std::size_t N> using mp_repeat_c = /*...*/;
template<class L, class N> using mp_repeat = /*...*/;
template<template<class...> class F, class... L> using mp_product = /*...*/;
template<class L, std::size_t N> using mp_drop_c = /*...*/;
template<class L, class N> using mp_drop = /*...*/;
template<std::size_t N> using mp_iota_c = /*...*/;
template<class N> using mp_iota = /*...*/;
template<class L, std::size_t I> using mp_at_c = /*...*/;
template<class L, class I> using mp_at = /*...*/;
template<class L, std::size_t N> using mp_take_c = /*...*/;
template<class L, class N> using mp_take = /*...*/;
template<class L, class V, class W> using mp_replace = /*...*/;
template<class L, template<class...> class P, class W> using mp_replace_if = /*...*/;
template<class L, template<class...> class P> using mp_copy_if = /*...*/;
template<class L, class V> using mp_remove = /*...*/;
template<class L, template<class...> class P> using mp_remove_if = /*...*/;
template<class L, template<class...> class P> using mp_partition = /*...*/;
template<class L, template<class...> class P> using mp_sort = /*...*/;
template<class L, class V> using mp_find_index = /*...*/;
template<class L, template<class...> class P> using mp_find_index_if = /*...*/;
template<class L, class V> using mp_find = mp_drop<L, mp_find_index<L, V>>;
template<class L, template<class...> class P> using mp_find_if = mp_drop<L, mp_find_index_if<L, P>>;
template<class L> using mp_reverse = /*...*/;
template<class L, class V, template<class...> class F> using mp_fold = /*...*/;
template<class L, class V, template<class...> class F> using mp_reverse_fold = /*...*/;
template<class L> using mp_unique = /*...*/;
template<class L, template<class...> class P> using mp_all_of = mp_bool< mp_count_if<L, P>::value == mp_size<L>::value >;
template<class L, template<class...> class P> using mp_none_of = mp_bool< mp_count_if<L, P>::value == 0 >;
template<class L, template<class...> class P> using mp_any_of = mp_bool< mp_count_if<L, P>::value != 0 >;
A set is a list whose elements are unique.
template<class S, class V> using mp_set_contains = /*...*/;
mp_set_contains<S, V> is mp_true
if the type V is an element
of the set S, mp_false otherwise.
template<class S, class... T> using mp_set_push_back = /*...*/;
For each T1 in T...,
mp_set_push_back<S, T...> appends T1
to the end of S if it's
not already an element of S.
template<class S, class... T> using mp_set_push_front = /*...*/;
mp_set_push_front<S, T...> inserts at the front of S those elements of T... for which S
does not already contain the same type.
A map is a list of lists, the inner lists having at least one element (the key.) The keys of the map must be unique.
template<class M, class K> using mp_map_find = /*...*/;
mp_map_find<M, K> is an alias for the element of the
map M with a key K, or for void,
if there is no such element.
template<class M, class K> using mp_map_contains = mp_not<std::is_same<mp_map_find<M, K>, void>>;
mp_map_contains<M, K> is mp_true,
if the map M contains an
element with a key K,
mp_false otherwise.
template<class M, class T> using mp_map_insert = mp_if< mp_map_contains<M, mp_first<T>>, M, mp_push_back<M, T> >;
Inserts the element T into
the map M, if an element
with a key mp_first<T>
is not already in M.
template<class M, class T> using mp_map_replace = /*...*/;
If the map M does not contain
an element with a key mp_first<T>, inserts it (using mp_push_back<M, T>);
otherwise, replaces the existing element with T.
template<class M, class T, template<class...> class F> using mp_map_update = /*...*/;
If the map M does not contain
an element with a key mp_first<T>, inserts it (using mp_push_back<M, T>);
otherwise, replaces the existing element L<X, Y...>
with L<X, F<X, Y...>>.
template<class M, class K> using mp_map_erase = /*...*/;
If the map M contains an
element with a key K, removes
it.
Last revised: March 15, 2017 at 16:06:15 GMT |