diff --git a/doc/Jamfile.v2 b/doc/Jamfile.v2 new file mode 100644 index 0000000..35d5468 --- /dev/null +++ b/doc/Jamfile.v2 @@ -0,0 +1,39 @@ +# Copyright (c) 2002 Douglas Gregor +# Copyright 2017 Peter Dimov + +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +project doc/mp11 ; + +import boostbook ; +import quickbook ; + +xml mp11_ : mp11.qbk ; +boostbook standalone_mp11 + : + mp11_ + : + boost.root=../../../.. + # File name of HTML output: + root.filename=mp11 + # How far down we chunk nested sections, basically all of them: + chunk.section.depth=0 + # Don't put the first section on the same page as the TOC: + chunk.first.sections=0 + # How far down sections get TOC's + toc.section.depth=3 + # Max depth in each TOC: + toc.max.depth=3 + # How far down we go with TOC's + generate.section.toc.level=0 + + generate.manifest=0 + ; + +############################################################################### +alias boostdoc ; +explicit boostdoc ; +alias boostrelease : standalone_mp11 ; +explicit boostrelease ; diff --git a/doc/html/mp11.html b/doc/html/mp11.html new file mode 100644 index 0000000..cfd8531 --- /dev/null +++ b/doc/html/mp11.html @@ -0,0 +1,923 @@ + + + +Chapter 1. Boost.Mp11 + + + + + + + + + + + + +
Boost C++ LibrariesHomeLibrariesPeopleFAQMore
+
+
+
+
+

+Chapter 1. Boost.Mp11

+
+
+

+ Distributed under the Boost + Software License, Version 1.0. +

+
+
+
+

Table of Contents

+
+
Overview
+
Reference
+
+
Integral Constants, <boost/mp11/integral.hpp>
+
+
mp_bool<B>
+
mp_true
+
mp_false
+
mp_to_bool<T>
+
mp_not<T>
+
mp_int<I>
+
mp_size_t<N>
+
+
List Operations, <boost/mp11/list.hpp>
+
+
mp_list<T...>
+
mp_size<L>
+
mp_empty<L>
+
mp_front<L>
+
mp_pop_front<L>
+
mp_first<L>
+
mp_rest<L>
+
mp_second<L>
+
mp_third<L>
+
mp_push_front<L, T...>
+
mp_push_back<L, T...>
+
mp_rename<L, + Y>
+
mp_append<L...>
+
+
Utility Components, <boost/mp11/utility.hpp>
+
+
mp_identity<T>
+
mp_identity_t<T>
+
mp_inherit<T...>
+
mp_if_c<B, T, E>
+
mp_if<C, + T, E>
+
mp_eval_if_c<B, T, F, + U...>
+
mp_eval_if<C, T, F, + U...>
+
mp_valid<F, T...>
+
mp_defer<F, T...>
+
mp_quote<F>
+
mp_unquote<Q, T...>
+
+
Algorithms, <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>
+
+
Set Operations, <boost/mp11/set.hpp>
+
+
mp_set_contains<S, V>
+
mp_set_push_back<S, T...>
+
mp_set_push_front<S, T...>
+
+
Map Operations, <boost/mp11/map.hpp>
+
+
mp_map_find<M, + K>
+
mp_map_contains<M, K>
+
mp_map_insert<M, T>
+
mp_map_replace<M, T>
+
mp_map_update<M, T, F>
+
mp_map_erase<M, K>
+
+
+
+
+
+ +

+ ... +

+
+
+ +
+ +
+ +
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_first = mp_front<L>;
+
+

+ mp_first is another name + for mp_front. +

+
+
+ +
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> struct mp_quote
+{
+    template<class... T> using apply = F<T...>;
+};
+
+

+ mp_quote<F> + transforms the template F + into a type. The nested template apply + of the result is an alias for F. +

+
+
+ +
template<class Q, class... T> using mp_unquote = typename Q::template apply<T...>;
+
+

+ mp_unquote<Q, T...>, where Q + is mp_quote<F>, + is an alias for F<T...>. +

+
+
+
+ +
+ +
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 14, 2017 at 20:19:38 GMT

+
+
+ + diff --git a/doc/mp11.qbk b/doc/mp11.qbk new file mode 100644 index 0000000..4b9795f --- /dev/null +++ b/doc/mp11.qbk @@ -0,0 +1,41 @@ +[/ + / Copyright 2017 Peter Dimov + / + / Distributed under the Boost Software License, Version 1.0. (See + / accompanying file LICENSE_1_0.txt or copy at + / http://www.boost.org/LICENSE_1_0.txt) + /] + +[library Boost.Mp11 + [quickbook 1.6] + [id mp11] + [copyright 2015-2017 Peter Dimov] + [dirname mp11] + [license Distributed under the + [@http://boost.org/LICENSE_1_0.txt Boost Software License, + Version 1.0]. + ] +] + +[template simplesect[title] +[block ''''''[title]'''''']] + +[template endsimplesect[] +[block '''''']] + +[section Overview] + +... + +[endsect] + +[section Reference] + +[include mp11/integral.qbk] +[include mp11/list.qbk] +[include mp11/utility.qbk] +[include mp11/algorithm.qbk] +[include mp11/set.qbk] +[include mp11/map.qbk] + +[endsect] diff --git a/doc/mp11/algorithm.qbk b/doc/mp11/algorithm.qbk new file mode 100644 index 0000000..ed9edcd --- /dev/null +++ b/doc/mp11/algorithm.qbk @@ -0,0 +1,159 @@ +[/ + / Copyright 2017 Peter Dimov + / + / Distributed under the Boost Software License, Version 1.0. (See + / accompanying file LICENSE_1_0.txt or copy at + / http://www.boost.org/LICENSE_1_0.txt) + /] + +[section:algorithm Algorithms, ``] + +[section `mp_assign`] + template using mp_assign = /*...*/; +[endsect] + +[section `mp_clear`] + template using mp_clear = mp_assign>; +[endsect] + +[section `mp_transform`] + template class F, class... L> using mp_transform = /*...*/; +[endsect] + +[section `mp_transform_if`] + template class P, template class F, class L> using mp_transform_if = /*...*/; +[endsect] + +[section `mp_fill`] + template using mp_fill = /*...*/; +[endsect] + +[section `mp_count`] + template using mp_count = /*...*/; +[endsect] + +[section `mp_count_if`] + template class P> using mp_count_if = /*...*/; +[endsect] + +[section `mp_contains`] + template using mp_contains = mp_to_bool>; +[endsect] + +[section `mp_repeat_c`] + template using mp_repeat_c = /*...*/; +[endsect] + +[section `mp_repeat`] + template using mp_repeat = /*...*/; +[endsect] + +[section `mp_product`] + template class F, class... L> using mp_product = /*...*/; +[endsect] + +[section `mp_drop_c`] + template using mp_drop_c = /*...*/; +[endsect] + +[section `mp_drop`] + template using mp_drop = /*...*/; +[endsect] + +[section `mp_iota_c`] + template using mp_iota_c = /*...*/; +[endsect] + +[section `mp_iota`] + template using mp_iota = /*...*/; +[endsect] + +[section `mp_at_c`] + template using mp_at_c = /*...*/; +[endsect] + +[section `mp_at`] + template using mp_at = /*...*/; +[endsect] + +[section `mp_take_c`] + template using mp_take_c = /*...*/; +[endsect] + +[section `mp_take`] + template using mp_take = /*...*/; +[endsect] + +[section `mp_replace`] + template using mp_replace = /*...*/; +[endsect] + +[section `mp_replace_if`] + template class P, class W> using mp_replace_if = /*...*/; +[endsect] + +[section `mp_copy_if`] + template class P> using mp_copy_if = /*...*/; +[endsect] + +[section `mp_remove`] + template using mp_remove = /*...*/; +[endsect] + +[section `mp_remove_if`] + template class P> using mp_remove_if = /*...*/; +[endsect] + +[section `mp_partition`] + template class P> using mp_partition = /*...*/; +[endsect] + +[section `mp_sort`] + template class P> using mp_sort = /*...*/; +[endsect] + +[section `mp_find_index`] + template using mp_find_index = /*...*/; +[endsect] + +[section `mp_find_index_if`] + template class P> using mp_find_index_if = /*...*/; +[endsect] + +[section `mp_find`] + template using mp_find = mp_drop>; +[endsect] + +[section `mp_find_if`] + template class P> using mp_find_if = mp_drop>; +[endsect] + +[section `mp_reverse`] + template using mp_reverse = /*...*/; +[endsect] + +[section `mp_fold`] + template class F> using mp_fold = /*...*/; +[endsect] + +[section `mp_reverse_fold`] + template class F> using mp_reverse_fold = /*...*/; +[endsect] + +[section `mp_unique`] + template using mp_unique = /*...*/; +[endsect] + +[section `mp_all_of`] + template class P> using mp_all_of = mp_bool< mp_count_if::value == mp_size::value >; +[endsect] + +[section `mp_none_of`] + template class P> using mp_none_of = mp_bool< mp_count_if::value == 0 >; +[endsect] + +[section `mp_any_of`] + template class P> using mp_any_of = mp_bool< mp_count_if::value != 0 >; +[endsect] + +[endsect] diff --git a/doc/mp11/integral.qbk b/doc/mp11/integral.qbk new file mode 100644 index 0000000..95f0260 --- /dev/null +++ b/doc/mp11/integral.qbk @@ -0,0 +1,39 @@ +[/ + / Copyright 2017 Peter Dimov + / + / Distributed under the Boost Software License, Version 1.0. (See + / accompanying file LICENSE_1_0.txt or copy at + / http://www.boost.org/LICENSE_1_0.txt) + /] + +[section:integral Integral Constants, ``] + +[section `mp_bool`] + template using mp_bool = std::integral_constant; +[endsect] + +[section `mp_true`] + using mp_true = mp_bool; +[endsect] + +[section `mp_false`] + using mp_false = mp_bool; +[endsect] + +[section `mp_to_bool`] + template using mp_to_bool = mp_bool(T::value)>; +[endsect] + +[section `mp_not`] + template using mp_not = mp_bool< !T::value >; +[endsect] + +[section `mp_int`] + template using mp_int = std::integral_constant; +[endsect] + +[section `mp_size_t`] + template using mp_size_t = std::integral_constant; +[endsect] + +[endsect] diff --git a/doc/mp11/list.qbk b/doc/mp11/list.qbk new file mode 100644 index 0000000..2f972ad --- /dev/null +++ b/doc/mp11/list.qbk @@ -0,0 +1,95 @@ +[/ + / Copyright 2017 Peter Dimov + / + / Distributed under the Boost Software License, Version 1.0. (See + / accompanying file LICENSE_1_0.txt or copy at + / http://www.boost.org/LICENSE_1_0.txt) + /] + +[section:list List Operations, ``] + +[section `mp_list`] + template 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. +[endsect] + +[section `mp_size`] + template using mp_size = /*...*/; + +`mp_size` returns the number of elements in the list `L`, as a `mp_size_t`. In other words, `mp_size>` is an alias for +`mp_size_t`. +[endsect] + +[section `mp_empty`] + template using mp_empty = mp_bool::value == 0>; + +`mp_empty` is an alias for `mp_true` if the list `L` is empty, for `mp_false` otherwise. +[endsect] + +[section `mp_front`] + template using mp_front = /*...*/; + +`mp_front` is the first element of the list `L`. That is, `mp_front>` is an alias for `T1`. +[endsect] + +[section `mp_pop_front`] + template using mp_pop_front = /*...*/; + +`mp_pop_front` removes the first element of the list `L`. That is, `mp_pop_front>` is an alias for `L`. +[endsect] + +[section `mp_first`] + template using mp_first = mp_front; + +`mp_first` is another name for `mp_front`. +[endsect] + +[section `mp_rest`] + template using mp_rest = mp_pop_front; + +`mp_rest` is another name for `mp_pop_front`. +[endsect] + +[section `mp_second`] + template using mp_second = /*...*/; + +`mp_second` is the second element of the list `L`. That is, `mp_second>` is an alias for `T2`. +[endsect] + +[section `mp_third`] + template using mp_third = /*...*/; + +`mp_third` is the third element of the list `L`. That is, `mp_third>` is an alias for `T3`. +[endsect] + +[section `mp_push_front`] + template using mp_push_front = /*...*/; + +`mp_push_front` inserts the elements `T...` at the front of the list `L`. That is, `mp_push_front, T...>` +is an alias for `L`. +[endsect] + +[section `mp_push_back`] + template using mp_push_back = /*...*/; + +`mp_push_back` inserts the elements `T...` at the back of the list `L`. That is, `mp_push_back, T...>` +is an alias for `L`. +[endsect] + +[section `mp_rename`] + template class Y> using mp_rename = /*...*/; + +`mp_rename` changes the type of the list `L` to `Y`. That is, `mp_rename, Y>` is an alias for `Y`. +[endsect] + +[section `mp_append`] + template using mp_append = /*...*/; + +`mp_append` 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, L2, ..., Ln>` is an alias for `L1`. +[endsect] + +[endsect] diff --git a/doc/mp11/map.qbk b/doc/mp11/map.qbk new file mode 100644 index 0000000..f7c1fdb --- /dev/null +++ b/doc/mp11/map.qbk @@ -0,0 +1,51 @@ +[/ + / Copyright 2017 Peter Dimov + / + / Distributed under the Boost Software License, Version 1.0. (See + / accompanying file LICENSE_1_0.txt or copy at + / http://www.boost.org/LICENSE_1_0.txt) + /] + +[section:map Map Operations, ``] + +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. + +[section `mp_map_find`] + template using mp_map_find = /*...*/; + +`mp_map_find` is an alias for the element of the map `M` with a key `K`, or for `void`, if there is no such element. +[endsect] + +[section `mp_map_contains`] + template using mp_map_contains = mp_not, void>>; + +`mp_map_contains` is `mp_true`, if the map `M` contains an element with a key `K`, `mp_false` otherwise. +[endsect] + +[section `mp_map_insert`] + template using mp_map_insert = mp_if< mp_map_contains>, M, mp_push_back >; + +Inserts the element `T` into the map `M`, if an element with a key `mp_first` is not already in `M`. +[endsect] + +[section `mp_map_replace`] + template using mp_map_replace = /*...*/; + +If the map `M` does not contain an element with a key `mp_first`, inserts it (using `mp_push_back`); otherwise, +replaces the existing element with `T`. +[endsect] + +[section `mp_map_update`] + template class F> using mp_map_update = /*...*/; + +If the map `M` does not contain an element with a key `mp_first`, inserts it (using `mp_push_back`); otherwise, +replaces the existing element `L` with `L>`. +[endsect] + +[section `mp_map_erase`] + template using mp_map_erase = /*...*/; + +If the map `M` contains an element with a key `K`, removes it. +[endsect] + +[endsect] diff --git a/doc/mp11/set.qbk b/doc/mp11/set.qbk new file mode 100644 index 0000000..a646823 --- /dev/null +++ b/doc/mp11/set.qbk @@ -0,0 +1,31 @@ +[/ + / Copyright 2017 Peter Dimov + / + / Distributed under the Boost Software License, Version 1.0. (See + / accompanying file LICENSE_1_0.txt or copy at + / http://www.boost.org/LICENSE_1_0.txt) + /] + +[section:set Set Operations, ``] + +A set is a list whose elements are unique. + +[section `mp_set_contains`] + template using mp_set_contains = /*...*/; + +`mp_set_contains` is `mp_true` if the type `V` is an element of the set `S`, `mp_false` otherwise. +[endsect] + +[section `mp_set_push_back`] + template using mp_set_push_back = /*...*/; + +For each `T1` in `T...`, `mp_set_push_back` appends `T1` to the end of `S` if it's not already an element of `S`. +[endsect] + +[section `mp_set_push_front`] + template using mp_set_push_front = /*...*/; + +`mp_set_push_front` inserts at the front of `S` those elements of `T...` for which `S` does not already contain the same type. +[endsect] + +[endsect] diff --git a/doc/mp11/utility.qbk b/doc/mp11/utility.qbk new file mode 100644 index 0000000..51c39d3 --- /dev/null +++ b/doc/mp11/utility.qbk @@ -0,0 +1,79 @@ +[/ + / Copyright 2017 Peter Dimov + / + / Distributed under the Boost Software License, Version 1.0. (See + / accompanying file LICENSE_1_0.txt or copy at + / http://www.boost.org/LICENSE_1_0.txt) + /] + +[section:utility Utility Components, ``] + +[section `mp_identity`] + template struct mp_identity + { + using type = T; + }; +[endsect] + +[section `mp_identity_t`] + template using mp_identity_t = T; +[endsect] + +[section `mp_inherit`] + template struct mp_inherit: T... {}; +[endsect] + +[section `mp_if_c`] + template using mp_if_c = /*...*/; + +`mp_if_c` is an alias for `T` when `B` is `true`, for `E` otherwise. +[endsect] + +[section `mp_if`] + template using mp_if = mp_if_c(C::value), T, E>; + +`mp_if` is an alias for `T` when `C::value` is `true`, for `E` otherwise. +[endsect] + +[section `mp_eval_if_c`] + template class F, class... U> using mp_eval_if_c = /*...*/; + +`mp_eval_if_c` is an alias for `T` when `B` is `true`, for `F` otherwise. Its purpose +is to avoid evaluating `F` when the condition is `true` as it may not be valid in this case. +[endsect] + +[section `mp_eval_if`] + template class F, class... U> using mp_eval_if = mp_eval_if_c(C::value), T, F, U...>; + +Like `mp_eval_if_c`, but the first argument is a type. +[endsect] + +[section `mp_valid`] + template class F, class... T> using mp_valid = /*...*/; + +`mp_valid` is an alias for `mp_true` when `F` is a valid expression, for `mp_false` otherwise. +[endsect] + +[section `mp_defer`] + template class F, class... T> using mp_defer = /*...*/; + +When `mp_valid` is `mp_true`, `mp_defer` is a struct with a nested type `type` which is an alias for `F`. Otherwise, +`mp_defer` is an empty struct. +[endsect] + +[section `mp_quote`] + template class F> struct mp_quote + { + template using apply = F; + }; + +`mp_quote` transforms the template `F` into a type. The nested template `apply` of the result is an alias for `F`. +[endsect] + +[section `mp_unquote`] + template using mp_unquote = typename Q::template apply; + +`mp_unquote`, where `Q` is `mp_quote`, is an alias for `F`. +[endsect] + +[endsect]