From 9deb752095d2ff36d9f658c016b94415597be8ff Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Fri, 9 Jun 2017 20:35:21 +0300 Subject: [PATCH 1/2] Update documentation --- doc/html/mp11.html | 192 +++++++++++++++++++++++++++++++++------- doc/mp11/algorithm.adoc | 28 ++++-- doc/mp11/function.adoc | 28 +++++- doc/mp11/list.adoc | 32 +++++++ doc/mp11/map.adoc | 3 +- doc/mp11/utility.adoc | 15 +++- 6 files changed, 252 insertions(+), 46 deletions(-) diff --git a/doc/html/mp11.html b/doc/html/mp11.html index 0fb5124..2cbb49f 100644 --- a/doc/html/mp11.html +++ b/doc/html/mp11.html @@ -1354,6 +1354,9 @@ the list.

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)>.

+
+

Examples:

+
using L1 = mp_list<>;
@@ -1394,6 +1397,9 @@ using R3 = mp_size<L3>; // mp_size_t<1>

mp_front<L> is the first element of the list L. That is, mp_front<L<T1, T…​>> is an alias for T1.

+
+

Examples:

+
using L1 = std::pair<int, float>;
@@ -1423,6 +1429,9 @@ using R3 = mp_front<L3>; // char[1]

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…​>.

+
+

Examples:

+
using L1 = std::tuple<float, double, long double>;
@@ -1468,6 +1477,9 @@ using R2 = mp_pop_front<L2>; // mp_list<>

mp_second<L> is the second element of the list L. That is, mp_second<L<T1, T2, T…​>> is an alias for T2.

+
+

Examples:

+
using L1 = std::pair<int, float>;
@@ -1497,6 +1509,9 @@ using R3 = mp_second<L3>; // char[2]

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.

+
+

Examples:

+
using L1 = std::tuple<float, double, long double>;
@@ -1521,6 +1536,9 @@ using R2 = mp_third<L2>; // char[3]

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…​>.

+
+

Examples:

+
using L1 = std::tuple<double, long double>;
@@ -1545,6 +1563,9 @@ using R2 = mp_push_front<L2, char[1], char[2]>; // mp_list<char[1], cha
 

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…​>.

+
+

Examples:

+
using L1 = std::tuple<double, long double>;
@@ -1568,6 +1589,9 @@ using R2 = mp_push_back<L2, char[1], char[2]>; // mp_list<void, char[1]
 

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…​>.

+
+

Examples:

+
using L1 = std::pair<double, long double>;
@@ -1592,6 +1616,9 @@ using R2 = mp_rename<L2, mp_list>; // mp_list<void>

mp_apply<F, L> applies the metafunction F to the contents of the list L, that is, mp_apply<F, L<T…​>> is an alias for F<T…​>. (mp_apply is the same as mp_rename with the arguments reversed.)

+
+

Example:

+
using L1 = std::pair<double, long double>;
@@ -1609,6 +1636,9 @@ using R1 = mp_apply<std::is_same, L1>; // std::is_same<double, long dou
 

Same as mp_apply, but takes a quoted metafunction.

+
+

Example:

+
using L1 = std::tuple<double, long double>;
@@ -1630,6 +1660,9 @@ using R1 = mp_apply_q<mp_bind_front<mp_push_back, L1>, L2>;
 

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…​>.

+
+

Example:

+
using L1 = std::tuple<double, long double>;
@@ -1652,6 +1685,9 @@ using R1 = mp_append<L1, L2, L3, L4>; // std::tuple<double, long double
 

mp_replace_front<L, T> replaces the first element of the list L with T. That is, mp_replace_front<L<U1, U…​>, T> is an alias for L<T, U…​>.

+
+

Examples:

+
using L1 = std::pair<int, float>;
@@ -1693,6 +1729,9 @@ using R3 = mp_replace_front<L3, void>; // mp_list<void, char[2], char[3
 

mp_replace_second<L, T> replaces the second element of the list L with T. That is, mp_replace_second<L<U1, U2, U…​>, T> is an alias for L<U1, T, U…​>.

+
+

Examples:

+
using L1 = std::pair<int, float>;
@@ -1723,6 +1762,9 @@ using R3 = mp_replace_second<L3, void>; // mp_list<char[1], void, char[
 

mp_replace_third<L, T> replaces the third element of the list L with T. That is, mp_replace_third<L<U1, U2, U3, U…​>, T> is an alias for L<U1, U2, T, U…​>.

+
+

Examples:

+
using L1 = std::tuple<float, double, long double>;
@@ -1776,15 +1818,23 @@ using R2 = mp_replace_third<L2, void>; // mp_list<char[1], char[2], voi
 

mp_if_c<true, T, E…​> is an alias for T. mp_if_c<false, T, E> is an alias for E. Otherwise, the result is a substitution failure.

+
+

Examples:

+
-
using R1 = mp_if_c<true, int, void>;  // int
-using R2 = mp_if_c<flase, int, void>; // void
+
using R1 = mp_if_c<true, int, void>;  // int
-
template<class I> using void_if_5 = mp_if_c<I::value == 5, void>; // `void` when `I::value` is 5, substitution failure otherwise
+
using R2 = mp_if_c<flase, int, void>; // void
+
+
+
+
+
template<class I> using void_if_5 = mp_if_c<I::value == 5, void>;
+  // `void` when `I::value` is 5, substitution failure otherwise
@@ -1792,7 +1842,8 @@ using R2 = mp_if_c<flase, int, void>; // void

mp_if<C, T, E…​>

-
template<class C, class T, class E...> using mp_if = mp_if_c<static_cast<bool>(C::value), T, E...>;
+
template<class C, class T, class E...> using mp_if =
+    mp_if_c<static_cast<bool>(C::value), T, E...>;
@@ -1815,7 +1866,8 @@ is to avoid evaluating F<U…​> when the condition

mp_eval_if<C, T, F, U…​>

-
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...>;
+
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...>;
@@ -1826,7 +1878,8 @@ is to avoid evaluating F<U…​> when the condition

mp_eval_if_q<C, T, Q, U…​>

-
template<class C, class T, class Q, class... U> using mp_eval_if_q = mp_eval_if<C, T, Q::template fn, U...>;
+
template<class C, class T, class Q, class... U> using mp_eval_if_q =
+    mp_eval_if<C, T, Q::template fn, U...>;
@@ -2135,7 +2188,8 @@ where T is the type of N::value.

mp_insert_c<L, I, T…​>

-
template<class L, std::size_t I, class... T> using mp_insert_c = mp_append<mp_take_c<L, I>, mp_push_front<mp_drop_c<L, I>, T...>>;
+
template<class L, std::size_t I, class... T> using mp_insert_c =
+    mp_append<mp_take_c<L, I>, mp_push_front<mp_drop_c<L, I>, T...>>;
@@ -2146,7 +2200,8 @@ where T is the type of N::value.

mp_insert<L, I, T…​>

-
template<class L, class I, class... T> using mp_insert = mp_append<mp_take<L, I>, mp_push_front<mp_drop<L, I>, T...>>;
+
template<class L, class I, class... T> using mp_insert =
+    mp_append<mp_take<L, I>, mp_push_front<mp_drop<L, I>, T...>>;
@@ -2157,7 +2212,8 @@ where T is the type of N::value.

mp_erase_c<L, I, J>

-
template<class L, std::size_t I, std::size_t J> using mp_erase = mp_append<mp_take_c<L, I>, mp_drop_c<L, J>>;
+
template<class L, std::size_t I, std::size_t J> using mp_erase_c =
+    mp_append<mp_take_c<L, I>, mp_drop_c<L, J>>;
@@ -2168,7 +2224,8 @@ where T is the type of N::value.

mp_erase<L, I, J>

-
template<class L, class I, class J> using mp_erase = mp_append<mp_take<L, I>, mp_drop<L, J>>;
+
template<class L, class I, class J> using mp_erase =
+    mp_append<mp_take<L, I>, mp_drop<L, J>>;
@@ -2274,6 +2331,17 @@ for the elements of L<U1…​> and mp_false

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

+
+

Example:

+
+
+
+
#include <ratio>
+
+using L1 = mp_list<std::ratio<1,2>, std::ratio<1,4>>;
+using R1 = mp_sort<L1, std::ratio_less>; // mp_list<ratio<1,4>, ratio<1,2>>
+
+

mp_find<L, V>

@@ -2348,7 +2416,8 @@ is mp_size<L>.

mp_all_of<L, P>

-
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_all_of =
+    mp_bool< mp_count_if<L, P>::value == mp_size<L>::value >;
@@ -2359,7 +2428,8 @@ is mp_size<L>.

mp_none_of<L, P>

-
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_none_of =
+    mp_bool< mp_count_if<L, P>::value == 0 >;
@@ -2370,7 +2440,8 @@ is mp_size<L>.

mp_any_of<L, P>

-
template<class L, template<class...> class P> using mp_any_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 >;
@@ -2481,7 +2552,8 @@ is mp_size<L>.

mp_map_insert<M, T>

-
template<class M, class T> using mp_map_insert = mp_if< mp_map_contains<M, mp_first<T>>, M, mp_push_back<M, T> >;
+
template<class M, class T> using mp_map_insert =
+    mp_if< mp_map_contains<M, mp_first<T>>, M, mp_push_back<M, T> >;
@@ -2549,12 +2621,27 @@ replaces the existing element L<X, Y…​> with mp_false. If the application causes a substitution failure, returns mp_false. If all results are mp_true, returns mp_true. mp_and<> is mp_true.

+
+

Examples:

+
-
using R1 = mp_and<mp_true, mp_true>;   // mp_true
-using R2 = mp_and<mp_false, void>;     // mp_false, void is not reached
-using R3 = mp_and<mp_false, mp_false>; // mp_false
-using R4 = mp_and<void, mp_true>;      // mp_false (!)
+
using R1 = mp_and<mp_true, mp_true>;   // mp_true
+
+
+
+
+
using R2 = mp_and<mp_false, void>;     // mp_false, void is not reached
+
+
+
+
+
using R3 = mp_and<mp_false, mp_false>; // mp_false
+
+
+
+
+
using R4 = mp_and<void, mp_true>;      // mp_false (!)
@@ -2571,12 +2658,27 @@ using R4 = mp_and<void, mp_true>; // mp_false (!)
is an error because void does not have a nested value. The upside is that mp_all is potentially faster and does not mask substitution failures as mp_and does.

+
+

Examples:

+
-
using R1 = mp_and<mp_true, mp_true>;   // mp_true
-using R2 = mp_and<mp_false, void>;     // compile-time error
-using R3 = mp_and<mp_false, mp_false>; // mp_false
-using R4 = mp_and<void, mp_true>;      // compile-time error
+
using R1 = mp_all<mp_true, mp_true>;   // mp_true
+
+
+
+
+
using R2 = mp_all<mp_false, void>;     // compile-time error
+
+
+
+
+
using R3 = mp_all<mp_false, mp_false>; // mp_false
+
+
+
+
+
using R4 = mp_all<void, mp_true>;      // compile-time error
@@ -2591,12 +2693,27 @@ using R4 = mp_and<void, mp_true>; // compile-time error

mp_or<T…​> applies mp_to_bool to the types in T…​, in order. If the result of an application is mp_true, mp_or returns mp_true. If all results are mp_false, returns mp_false. mp_or<> is mp_false.

+
+

Examples:

+
-
using R1 = mp_or<mp_true, mp_false>;   // mp_true
-using R2 = mp_or<mp_true, void>;       // mp_true, void is not reached
-using R3 = mp_or<mp_false, mp_false>;  // mp_false
-using R4 = mp_or<void, mp_true>;       // compile-time error
+
using R1 = mp_or<mp_true, mp_false>;   // mp_true
+
+
+
+
+
using R2 = mp_or<mp_true, void>;       // mp_true, void is not reached
+
+
+
+
+
using R3 = mp_or<mp_false, mp_false>;  // mp_false
+
+
+
+
+
using R4 = mp_or<void, mp_true>;       // compile-time error
@@ -2611,12 +2728,27 @@ using R4 = mp_or<void, mp_true>; // compile-time error

mp_any<T…​> is mp_true if mp_to_bool<U> is mp_true for any type U in T…​, mp_false otherwise. Same as mp_or, but does not perform short-circuit evaluation.

+
+

Examples:

+
-
using R1 = mp_any<mp_true, mp_false>;  // mp_true
-using R2 = mp_any<mp_true, void>;      // compile-time error
-using R3 = mp_any<mp_false, mp_false>; // mp_false
-using R4 = mp_any<void, mp_true>;      // compile-time error
+
using R1 = mp_any<mp_true, mp_false>;  // mp_true
+
+
+
+
+
using R2 = mp_any<mp_true, void>;      // compile-time error
+
+
+
+
+
using R3 = mp_any<mp_false, mp_false>; // mp_false
+
+
+
+
+
using R4 = mp_any<void, mp_true>;      // compile-time error
diff --git a/doc/mp11/algorithm.adoc b/doc/mp11/algorithm.adoc index 0f45219..95e8498 100644 --- a/doc/mp11/algorithm.adoc +++ b/doc/mp11/algorithm.adoc @@ -152,25 +152,29 @@ Same as `mp_take_c`, but with a type argument `N`. `N::value` must be a nonnegat ## mp_insert_c - template using mp_insert_c = mp_append, mp_push_front, T...>>; + template using mp_insert_c = + mp_append, mp_push_front, T...>>; Inserts the elements `T...` into the list `L` at position `I` (a zero-based index). ## mp_insert - template using mp_insert = mp_append, mp_push_front, T...>>; + template using mp_insert = + mp_append, mp_push_front, T...>>; Same as `mp_insert_c`, but with a type argument `I`. ## mp_erase_c - template using mp_erase = mp_append, mp_drop_c>; + template using mp_erase_c = + mp_append, mp_drop_c>; Removes from the list `L` the elements with indices from `I` (inclusive) to `J` (exclusive). ## mp_erase - template using mp_erase = mp_append, mp_drop>; + template using mp_erase = + mp_append, mp_drop>; Same as `mp_erase_c`, but with a type arguments `I` and `J`. @@ -229,6 +233,13 @@ for the elements of `L` and `mp_false` for the elements of `L`. Re `mp_sort` sorts the list `L` according to the strict weak ordering `mp_to_bool>`. +Example: +``` +#include + +using L1 = mp_list, std::ratio<1,4>>; +using R1 = mp_sort; // mp_list, ratio<1,2>> +``` ## mp_find template using mp_find = /*...*/; @@ -270,19 +281,22 @@ is `mp_size`. ## mp_all_of - template class P> using mp_all_of = mp_bool< mp_count_if::value == mp_size::value >; + template class P> using mp_all_of = + mp_bool< mp_count_if::value == mp_size::value >; `mp_all_of` is `mp_true` when `P` holds for all elements of `L`, `mp_false` otherwise. When `L` is empty, the result is `mp_true`. ## mp_none_of - template class P> using mp_none_of = mp_bool< mp_count_if::value == 0 >; + template class P> using mp_none_of = + mp_bool< mp_count_if::value == 0 >; `mp_none_of` is `mp_true` when `P` holds for no element of `L`, `mp_false` otherwise. When `L` is empty, the result is `mp_true`. ## mp_any_of - template class P> using mp_any_of = mp_bool< mp_count_if::value != 0 >; + template class P> using mp_any_of = + mp_bool< mp_count_if::value != 0 >; `mp_any_of` is `mp_true` when `P` holds for at least one element of `L`, `mp_false` otherwise. When `L` is empty, the result is `mp_false`. diff --git a/doc/mp11/function.adoc b/doc/mp11/function.adoc index 66168c2..e9f39a4 100644 --- a/doc/mp11/function.adoc +++ b/doc/mp11/function.adoc @@ -27,9 +27,14 @@ Same as `std::void_t` from C++17. returns `mp_false`. If the application causes a substitution failure, returns `mp_false`. If all results are `mp_true`, returns `mp_true`. `mp_and<>` is `mp_true`. +Examples: + using R1 = mp_and; // mp_true + using R2 = mp_and; // mp_false, void is not reached + using R3 = mp_and; // mp_false + using R4 = mp_and; // mp_false (!) ## mp_all @@ -41,10 +46,15 @@ returns `mp_true`. `mp_and<>` is `mp_true`. is an error because `void` does not have a nested `value`. The upside is that `mp_all` is potentially faster and does not mask substitution failures as `mp_and` does. - using R1 = mp_and; // mp_true - using R2 = mp_and; // compile-time error - using R3 = mp_and; // mp_false - using R4 = mp_and; // compile-time error +Examples: + + using R1 = mp_all; // mp_true + + using R2 = mp_all; // compile-time error + + using R3 = mp_all; // mp_false + + using R4 = mp_all; // compile-time error ## mp_or @@ -53,9 +63,14 @@ mask substitution failures as `mp_and` does. `mp_or` applies `mp_to_bool` to the types in `T...`, in order. If the result of an application is `mp_true`, `mp_or` returns `mp_true`. If all results are `mp_false`, returns `mp_false`. `mp_or<>` is `mp_false`. +Examples: + using R1 = mp_or; // mp_true + using R2 = mp_or; // mp_true, void is not reached + using R3 = mp_or; // mp_false + using R4 = mp_or; // compile-time error ## mp_any @@ -65,9 +80,14 @@ returns `mp_true`. If all results are `mp_false`, returns `mp_false`. `mp_or<>` `mp_any` is `mp_true` if `mp_to_bool` is `mp_true` for any type `U` in `T...`, `mp_false` otherwise. Same as `mp_or`, but does not perform short-circuit evaluation. +Examples: + using R1 = mp_any; // mp_true + using R2 = mp_any; // compile-time error + using R3 = mp_any; // mp_false + using R4 = mp_any; // compile-time error ## mp_same diff --git a/doc/mp11/list.adoc b/doc/mp11/list.adoc index 73c5a26..57a9abf 100644 --- a/doc/mp11/list.adoc +++ b/doc/mp11/list.adoc @@ -28,6 +28,8 @@ the list. `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`. +Examples: + using L1 = mp_list<>; using R1 = mp_size; // mp_size_t\<0> @@ -49,6 +51,8 @@ the list. `mp_front` is the first element of the list `L`. That is, `mp_front>` is an alias for `T1`. +Examples: + using L1 = std::pair; using R1 = mp_front; // int @@ -64,6 +68,8 @@ the list. `mp_pop_front` removes the first element of the list `L`. That is, `mp_pop_front>` is an alias for `L`. +Examples: + using L1 = std::tuple; using R1 = mp_pop_front; // std::tuple @@ -88,6 +94,8 @@ the list. `mp_second` is the second element of the list `L`. That is, `mp_second>` is an alias for `T2`. +Examples: + using L1 = std::pair; using R1 = mp_second; // float @@ -103,6 +111,8 @@ the list. `mp_third` is the third element of the list `L`. That is, `mp_third>` is an alias for `T3`. +Examples: + using L1 = std::tuple; using R1 = mp_third; // long double @@ -116,6 +126,8 @@ the list. `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`. +Examples: + using L1 = std::tuple; using R1 = mp_push_front; // std::tuple @@ -129,6 +141,8 @@ is an alias for `L`. `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`. +Examples: + using L1 = std::tuple; using R1 = mp_push_back; // std::tuple @@ -141,6 +155,8 @@ is an alias for `L`. `mp_rename` changes the type of the list `L` to `Y`. That is, `mp_rename, Y>` is an alias for `Y`. +Examples: + using L1 = std::pair; using R1 = mp_rename; // std::tuple @@ -154,6 +170,8 @@ is an alias for `L`. `mp_apply` applies the metafunction `F` to the contents of the list `L`, that is, `mp_apply>` is an alias for `F`. (`mp_apply` is the same as `mp_rename` with the arguments reversed.) +Example: + using L1 = std::pair; using R1 = mp_apply; // std::is_same @@ -162,6 +180,9 @@ is an alias for `L`. template using mp_apply_q = mp_apply; Same as `mp_apply`, but takes a quoted metafunction. + +Example: + ``` using L1 = std::tuple; using L2 = mp_list; @@ -169,12 +190,16 @@ using L2 = mp_list; using R1 = mp_apply_q, L2>; // R1 is std::tuple ``` + ## 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`. + +Example: + ``` using L1 = std::tuple; using L2 = mp_list; @@ -183,6 +208,7 @@ using L4 = mp_list<>; using R1 = mp_append; // std::tuple ``` + ## mp_replace_front template using mp_replace_front = /*...*/; @@ -190,6 +216,8 @@ using R1 = mp_append; // std::tuple` replaces the first element of the list `L` with `T`. That is, `mp_replace_front, T>` is an alias for `L`. +Examples: + using L1 = std::pair; using R1 = mp_replace_front; // std::pair @@ -212,6 +240,8 @@ an alias for `L`. `mp_replace_second` replaces the second element of the list `L` with `T`. That is, `mp_replace_second, T>` is an alias for `L`. +Examples: + using L1 = std::pair; using R1 = mp_replace_second; // std::pair @@ -228,6 +258,8 @@ is an alias for `L`. `mp_replace_third` replaces the third element of the list `L` with `T`. That is, `mp_replace_third, T>` is an alias for `L`. +Examples: + using L1 = std::tuple; using R1 = mp_replace_third; // std::tuple diff --git a/doc/mp11/map.adoc b/doc/mp11/map.adoc index 96da55c..475d9de 100644 --- a/doc/mp11/map.adoc +++ b/doc/mp11/map.adoc @@ -29,7 +29,8 @@ A map is a list of lists, the inner lists having at least one element (the key.) ## mp_map_insert - template using mp_map_insert = mp_if< mp_map_contains>, M, mp_push_back >; + 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`. diff --git a/doc/mp11/utility.adoc b/doc/mp11/utility.adoc index a0ac9ba..5799282 100644 --- a/doc/mp11/utility.adoc +++ b/doc/mp11/utility.adoc @@ -34,14 +34,19 @@ http://www.boost.org/LICENSE_1_0.txt `mp_if_c` is an alias for `T`. `mp_if_c` is an alias for `E`. Otherwise, the result is a substitution failure. +Examples: + using R1 = mp_if_c; // int + using R2 = mp_if_c; // void - template using void_if_5 = mp_if_c; // `void` when `I::value` is 5, substitution failure otherwise + template using void_if_5 = mp_if_c; + // `void` when `I::value` is 5, substitution failure otherwise ## mp_if - template using mp_if = mp_if_c(C::value), T, E...>; + template using mp_if = + mp_if_c(C::value), T, E...>; Like `mp_if_c`, but the first argument is a type. @@ -54,13 +59,15 @@ is to avoid evaluating `F` when the condition is `true` as it may not be v ## mp_eval_if - template class F, class... U> using mp_eval_if = mp_eval_if_c(C::value), T, F, U...>; + 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. ## mp_eval_if_q - template using mp_eval_if_q = mp_eval_if; + template using mp_eval_if_q = + mp_eval_if; Like `mp_eval_if`, but takes a quoted metafunction. From cbf539e16b180b267bfeace48234457fdcfa1d1e Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Sat, 10 Jun 2017 03:44:31 +0300 Subject: [PATCH 2/2] Update documentation --- doc/html/mp11.html | 937 +++++++++++++++++++++++---------- doc/mp11.adoc | 4 +- doc/mp11/algorithm.adoc | 202 ++++++- doc/mp11/bind.adoc | 6 +- doc/mp11/definitions.adoc | 30 +- doc/mp11/examples.adoc | 64 ++- doc/mp11/function.adoc | 52 +- doc/mp11/integer_sequence.adoc | 6 +- doc/mp11/integral.adoc | 6 + doc/mp11/list.adoc | 240 ++++++--- doc/mp11/map.adoc | 3 +- doc/mp11/overview.adoc | 5 +- doc/mp11/utility.adoc | 110 +++- 13 files changed, 1216 insertions(+), 449 deletions(-) diff --git a/doc/html/mp11.html b/doc/html/mp11.html index 2cbb49f..2095b7c 100644 --- a/doc/html/mp11.html +++ b/doc/html/mp11.html @@ -6,7 +6,7 @@ -Boost.Mp11 +Boost.Mp11: A C++11 metaprogramming library