From 9f35ce210757289b3598cb16ef1dce52a0e82c38 Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Wed, 15 Mar 2017 19:43:06 +0200 Subject: [PATCH] Add some more documentation --- doc/html/mp11.html | 161 +++++++++++++++++++++++++++++++++++++++-- doc/mp11/algorithm.qbk | 61 +++++++++++++++- 2 files changed, 215 insertions(+), 7 deletions(-) diff --git a/doc/html/mp11.html b/doc/html/mp11.html index 0304c01..c8b05d3 100644 --- a/doc/html/mp11.html +++ b/doc/html/mp11.html @@ -94,8 +94,8 @@
mp_product<F, L...>
mp_drop_c<L, N>
mp_drop<L, N>
-
mp_iota_c<L, N>
-
mp_iota<L, N>
+
mp_iota_c<N>
+
mp_iota<N>
mp_at_c<L, I>
mp_at<L, I>
@@ -529,6 +529,13 @@
template<class L1, class L2> using mp_assign = /*...*/;
 
+

+ mp_assign<L1<T1...>, + L2<T2...>> + is an alias for L1<T2...>. + That is, it replaces the elements of L1 + with those of L2. +

@@ -536,6 +543,11 @@

template<class L> using mp_clear = mp_assign<L, mp_list<>>;
 
+

+ mp_clear<L<T...>> + is an alias for L<>, + that is, it removes the elements of L. +

@@ -543,6 +555,12 @@

template<template<class...> class F, class... L> using mp_transform = /*...*/;
 
+

+ mp_transform<F, L1<T1...>, L2<T2...>, ..., + Ln<Tn...>> + applies F to each successive + tuple of elements and returns L1<F<T1, T2, ..., Tn>...>. +

@@ -550,6 +568,12 @@

template<template<class...> class P, template<class...> class F, class L> using mp_transform_if = /*...*/;
 
+

+ mp_transform_if replaces + the elements T of L for which mp_to_bool<P<T>> is mp_true + with F<T>, + and returns the result. +

@@ -557,6 +581,11 @@

template<class L, class V> using mp_fill = /*...*/;
 
+

+ mp_fill<L<T...>, V> + returns L<V, V, ..., V>, + with the result having the same size as the input. +

@@ -564,6 +593,11 @@

template<class L, class V> using mp_count = /*...*/;
 
+

+ mp_count<L, V> returns mp_size_t<N>, where N + is the number of elements of L + same as V. +

@@ -571,6 +605,12 @@

template<class L, template<class...> class P> using mp_count_if = /*...*/;
 
+

+ mp_count_f<L, P> returns mp_size_t<N>, where N + is the number of elements T + of L for which mp_to_bool<P<T>> + is mp_true. +

@@ -578,6 +618,12 @@

template<class L, class V> using mp_contains = mp_to_bool<mp_count<L, V>>;
 
+

+ mp_contains<L, V> is mp_true + when L contains an element + V, mp_false + otherwise. +

@@ -585,6 +631,10 @@

template<class L, std::size_t N> using mp_repeat_c = /*...*/;
 
+

+ mp_repeat_c<L, N> returns a list of the same type as + L that consists of N concatenated copies of L. +

@@ -592,6 +642,12 @@

template<class L, class N> using mp_repeat = /*...*/;
 
+

+ Same as mp_repeat_c but + with a type argument N. + The number of copies is N::value + and must be nonnegative. +

@@ -599,6 +655,15 @@

template<template<class...> class F, class... L> using mp_product = /*...*/;
 
+

+ mp_product<F, L1<T1...>, L2<T2...>, ..., + Ln<Tn...>> + evaluates F<U1, U2, ..., Un> for values Ui + taken from the Cartesian product of the lists, as if the elements Ui are formed by n + nested loops, each traversing Li. + It returns a list of type L1 + containing the results of the application of F. +

@@ -606,6 +671,11 @@

template<class L, std::size_t N> using mp_drop_c = /*...*/;
 
+

+ mp_drop_c<L, N> removes the first N + elements of L and returns + the result. +

@@ -613,20 +683,40 @@

template<class L, class N> using mp_drop = /*...*/;
 
+

+ Same as mp_drop_c, but + with a type argument N. + N::value must be a nonnegative number. +

template<std::size_t N> using mp_iota_c = /*...*/;
 
+

+ mp_iota_c<N> + is an alias for mp_list<mp_size_t<0>, + mp_size_t<1>, ..., + mp_size_t<N-1>>. +

template<class N> using mp_iota = /*...*/;
 
+

+ Same as mp_iota_c, but + with a type argument N. + N::value must be a nonnegative number. Returns + mp_list<std::integral_constant<T, 0>, std::integral_constant<T, 1>, + ..., std::integral_constant<T, N::value-1>> + where T is the type of + N::value. +

@@ -634,6 +724,10 @@

template<class L, std::size_t I> using mp_at_c = /*...*/;
 
+

+ mp_at_c<L, I> returns the Ith + element of L, zero-based. +

@@ -642,6 +736,11 @@

template<class L, class I> using mp_at = /*...*/;
 
+

+ Same as mp_at_c, but with + a type argument I. I::value + must be a nonnegative number. +

@@ -649,6 +748,11 @@

template<class L, std::size_t N> using mp_take_c = /*...*/;
 
+

+ mp_take_c<L, N> returns a list of the same type as + L containing the first + N elements of L. +

@@ -656,6 +760,11 @@

template<class L, class N> using mp_take = /*...*/;
 
+

+ Same as mp_take_c, but + with a type argument N. + N::value must be a nonnegative number. +

@@ -663,6 +772,10 @@

template<class L, class V, class W> using mp_replace = /*...*/;
 
+

+ Replaces all V elements + of L with W and returns the result. +

@@ -670,6 +783,11 @@

template<class L, template<class...> class P, class W> using mp_replace_if = /*...*/;
 
+

+ Replaces all T elements + of L for which mp_to_bool<P<T>> + is mp_true with W and returns the result. +

@@ -677,6 +795,12 @@

template<class L, template<class...> class P> using mp_copy_if = /*...*/;
 
+

+ Copies the elements T of + L for which mp_to_bool<P<T>> + is mp_true to a new list + of the same type and returns it. +

@@ -684,6 +808,10 @@

template<class L, class V> using mp_remove = /*...*/;
 
+

+ Removes all V elements + of L and returns the result. +

@@ -691,6 +819,12 @@

template<class L, template<class...> class P> using mp_remove_if = /*...*/;
 
+

+ Removes all elements T + of L for which mp_to_bool<P<T>> + is mp_true and returns + the result. +

@@ -698,6 +832,19 @@

template<class L, template<class...> class P> using mp_partition = /*...*/;
 
+

+ mp_partition<L<T...>, P> + partitions L into two lists + L<U1...> + and L<U2...> + such that mp_to_bool<P<T>> + is mp_true for the elements + of L<U1...> + and mp_false for the elements + of L<U2...>. + Returns L<L<U1...>, + L<U2...>>. +

@@ -705,6 +852,10 @@

template<class L, template<class...> class P> using mp_sort = /*...*/;
 
+

+ mp_sort<L, P> sorts the list L + according to the strict weak ordering mp_to_bool<P<T, U>>. +

@@ -916,7 +1067,7 @@

- +

Last revised: March 15, 2017 at 16:06:15 GMT

Last revised: March 15, 2017 at 17:28:31 GMT


diff --git a/doc/mp11/algorithm.qbk b/doc/mp11/algorithm.qbk index ed9edcd..7025c19 100644 --- a/doc/mp11/algorithm.qbk +++ b/doc/mp11/algorithm.qbk @@ -10,106 +10,163 @@ [section `mp_assign`] template using mp_assign = /*...*/; + +`mp_assign, L2>` is an alias for `L1`. That is, it replaces the elements of `L1` with those of `L2`. [endsect] [section `mp_clear`] template using mp_clear = mp_assign>; + +`mp_clear>` is an alias for `L<>`, that is, it removes the elements of `L`. [endsect] [section `mp_transform`] template class F, class... L> using mp_transform = /*...*/; + +`mp_transform, L2, ..., Ln>` applies `F` to each successive tuple of elements and returns `L1...>`. [endsect] [section `mp_transform_if`] template class P, template class F, class L> using mp_transform_if = /*...*/; + +`mp_transform_if` replaces the elements `T` of `L` for which `mp_to_bool>` is `mp_true` with `F`, and returns the result. [endsect] [section `mp_fill`] template using mp_fill = /*...*/; + +`mp_fill, V>` returns `L`, with the result having the same size as the input. [endsect] [section `mp_count`] template using mp_count = /*...*/; + +`mp_count` returns `mp_size_t`, where `N` is the number of elements of `L` same as `V`. [endsect] [section `mp_count_if`] template class P> using mp_count_if = /*...*/; + +`mp_count_f` returns `mp_size_t`, where `N` is the number of elements `T` of `L` for which `mp_to_bool>` is `mp_true`. [endsect] [section `mp_contains`] template using mp_contains = mp_to_bool>; + +`mp_contains` is `mp_true` when `L` contains an element `V`, `mp_false` otherwise. [endsect] [section `mp_repeat_c`] template using mp_repeat_c = /*...*/; + +`mp_repeat_c` returns a list of the same type as `L` that consists of `N` concatenated copies of `L`. [endsect] [section `mp_repeat`] template using mp_repeat = /*...*/; + +Same as `mp_repeat_c` but with a type argument `N`. The number of copies is `N::value` and must be nonnegative. [endsect] [section `mp_product`] template class F, class... L> using mp_product = /*...*/; + +`mp_product, L2, ..., Ln>` evaluates `F` for values `Ui` taken from +the Cartesian product of the lists, as if the elements `Ui` are formed by `n` nested loops, each traversing `Li`. +It returns a list of type `L1` containing the results of the application of `F`. [endsect] [section `mp_drop_c`] template using mp_drop_c = /*...*/; + +`mp_drop_c` removes the first `N` elements of `L` and returns the result. [endsect] [section `mp_drop`] template using mp_drop = /*...*/; + +Same as `mp_drop_c`, but with a type argument `N`. `N::value` must be a nonnegative number. [endsect] -[section `mp_iota_c`] +[section `mp_iota_c`] template using mp_iota_c = /*...*/; + +`mp_iota_c` is an alias for `mp_list, mp_size_t<1>, ..., mp_size_t>`. [endsect] -[section `mp_iota`] +[section `mp_iota`] template using mp_iota = /*...*/; + +Same as `mp_iota_c`, but with a type argument `N`. `N::value` must be a nonnegative number. Returns +`mp_list, std::integral_constant, ..., std::integral_constant>` +where `T` is the type of `N::value`. [endsect] [section `mp_at_c`] template using mp_at_c = /*...*/; + +`mp_at_c` returns the `I`th element of `L`, zero-based. [endsect] [section `mp_at`] template using mp_at = /*...*/; + +Same as `mp_at_c`, but with a type argument `I`. `I::value` must be a nonnegative number. [endsect] [section `mp_take_c`] template using mp_take_c = /*...*/; + +`mp_take_c` returns a list of the same type as `L` containing the first `N` elements of `L`. [endsect] [section `mp_take`] template using mp_take = /*...*/; + +Same as `mp_take_c`, but with a type argument `N`. `N::value` must be a nonnegative number. [endsect] [section `mp_replace`] template using mp_replace = /*...*/; + +Replaces all `V` elements of `L` with `W` and returns the result. [endsect] [section `mp_replace_if`] template class P, class W> using mp_replace_if = /*...*/; + +Replaces all `T` elements of `L` for which `mp_to_bool>` is `mp_true` with `W` and returns the result. [endsect] [section `mp_copy_if`] template class P> using mp_copy_if = /*...*/; + +Copies the elements `T` of `L` for which `mp_to_bool>` is `mp_true` to a new list of the same type and returns it. [endsect] [section `mp_remove`] template using mp_remove = /*...*/; + +Removes all `V` elements of `L` and returns the result. [endsect] [section `mp_remove_if`] template class P> using mp_remove_if = /*...*/; + +Removes all elements `T` of `L` for which `mp_to_bool>` is `mp_true` and returns the result. [endsect] [section `mp_partition`] template class P> using mp_partition = /*...*/; + +`mp_partition, P>` partitions `L` into two lists `L` and `L` such that `mp_to_bool>` is `mp_true` +for the elements of `L` and `mp_false` for the elements of `L`. Returns `L, L>`. [endsect] [section `mp_sort`] template class P> using mp_sort = /*...*/; + +`mp_sort` sorts the list `L` according to the strict weak ordering `mp_to_bool>`. [endsect] [section `mp_find_index`]