diff --git a/doc/mp11/list.adoc b/doc/mp11/list.adoc index 7e0abe4..038f4b1 100644 --- a/doc/mp11/list.adoc +++ b/doc/mp11/list.adoc @@ -101,6 +101,9 @@ using R2 = mp_empty; // mp_true `mp_assign, L2>` is an alias for `L1`. That is, it replaces the elements of `L1` with those of `L2`. +Supports value lists as `L1` or `L2` under {cpp}17. When assigning values to types, wraps them in `mp_value`. When assigning +types to values, unwraps them by using `T::value`. + .Using mp_assign with mp_list and std::tuple ``` using L1 = std::tuple; @@ -117,24 +120,42 @@ using L2 = mp_list; using R1 = mp_assign; // std::pair ``` +.Using mp_assign with value lists +``` +using L1 = mp_list; +using L2 = mp_list_v<0, false>; + +using R1 = mp_assign; // mp_list, mp_false> +``` + ## mp_clear template using mp_clear = mp_assign>; `mp_clear>` is an alias for `L<>`, that is, it removes the elements of `L`. +Supports value lists as `L` under {cpp}17. + .Using mp_clear with std::tuple ``` using L1 = std::tuple; using R1 = mp_clear; // std::tuple<> ``` +.Using mp_clear with mp_list_v +``` +using L1 = mp_list_v<0, true>; +using R1 = mp_clear; // mp_list_v<> +``` + ## 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`. +Supports value lists as `L` under {cpp}17. In that case, the returned element is wrapped with `mp_value`. + .Using mp_front with std::pair ``` using L1 = std::pair; @@ -153,12 +174,20 @@ using L3 = mp_list; using R3 = mp_front; // char[1] ``` +.Using mp_front with mp_list_v +``` +using L4 = mp_list_v<1, 2, 3, 4>; +using R4 = mp_front; // mp_int\<1> +``` + ## 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`. +Supports value lists as `L` under {cpp}17. + .Using mp_pop_front with std::tuple ``` using L1 = std::tuple; @@ -171,6 +200,12 @@ using L2 = mp_list; using R2 = mp_pop_front; // mp_list<> ``` +.Using mp_pop_front with mp_list_v +``` +using L3 = mp_list_v<1, 2, 3, 4>; +using R3 = mp_pop_front; // mp_list_v<2, 3, 4> +``` + ## mp_first template using mp_first = mp_front; @@ -189,6 +224,8 @@ using R2 = mp_pop_front; // mp_list<> `mp_second` is the second element of the list `L`. That is, `mp_second>` is an alias for `T2`. +Supports value lists as `L` under {cpp}17. In that case, the returned element is wrapped with `mp_value`. + .Using mp_second with std::pair ``` using L1 = std::pair; @@ -207,12 +244,20 @@ using L3 = mp_list; using R3 = mp_second; // char[2] ``` +.Using mp_second with mp_list_v +``` +using L4 = mp_list_v<1, 2, 3, 4>; +using R4 = mp_second; // mp_int\<2> +``` + ## 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`. +Supports value lists as `L` under {cpp}17. In that case, the returned element is wrapped with `mp_value`. + .Using mp_third with std::tuple ``` using L1 = std::tuple; @@ -225,6 +270,12 @@ using L2 = mp_list; using R2 = mp_third; // char[3] ``` +.Using mp_third with mp_list_v +``` +using L3 = mp_list<1, 2, 3, 4>; +using R3 = mp_third; // mp_int\<3> +``` + ## mp_push_front template using mp_push_front = /*...*/; @@ -232,6 +283,8 @@ using R2 = mp_third; // char[3] `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`. +Supports value lists as `L` under {cpp}17. In that case, `mp_push_front, T...>` is `L`. + .Using mp_push_front with std::tuple ``` using L1 = std::tuple; @@ -244,6 +297,12 @@ using L2 = mp_list; using R2 = mp_push_front; // mp_list ``` +.Using mp_push_front with mp_list_v +``` +using L3 = mp_list_v<0, 1>; +using R3 = mp_push_front; // mp_list_v +``` + ## mp_push_back template using mp_push_back = /*...*/; @@ -251,6 +310,8 @@ using R2 = mp_push_front; // mp_list` inserts the elements `T...` at the back of the list `L`. That is, `mp_push_back, T...>` is an alias for `L`. +Supports value lists as `L` under {cpp}17. In that case, `mp_push_back, T...>` is `L`. + .Using mp_push_back with std::tuple ``` using L1 = std::tuple; @@ -263,6 +324,12 @@ using L2 = mp_list; using R2 = mp_push_back; // mp_list ``` +.Using mp_push_back with mp_list_v +``` +using L3 = mp_list_v<0, 1>; +using R3 = mp_push_front; // mp_list_v<0, 1, true, false> +``` + ## mp_rename template class Y> using mp_rename = /*...*/; @@ -358,6 +425,8 @@ using R1 = mp_append; `mp_replace_front` replaces the first element of the list `L` with `T`. That is, `mp_replace_front, T>` is an alias for `L`. +Supports value lists as `L` under {cpp}17. In that case, `mp_replace_front, T>` is `L`. + .Using mp_replace_front with std::pair ``` using L1 = std::pair; @@ -376,6 +445,12 @@ using L3 = mp_list; using R3 = mp_replace_front; // mp_list; ``` +.Using mp_replace_front with mp_list_v +``` +using L4 = mp_list_v<1, 2, 3, 4>; +using R4 = mp_replace_front; // mp_list_v; +``` + ## mp_replace_first template using mp_replace_first = mp_replace_front; @@ -389,6 +464,8 @@ using R3 = mp_replace_front; // mp_list` replaces the second element of the list `L` with `T`. That is, `mp_replace_second, T>` is an alias for `L`. +Supports value lists as `L` under {cpp}17. In that case, `mp_replace_second, T>` is `L`. + .Using mp_replace_second with std::pair ``` using L1 = std::pair; @@ -407,6 +484,12 @@ using L3 = mp_list; using R3 = mp_replace_second; // mp_list; ``` +.Using mp_replace_second with mp_list_v +``` +using L4 = mp_list_v<1, 2, 3, 4>; +using R4 = mp_replace_second; // mp_list_v<1, false, 3, 4>; +``` + ## mp_replace_third template using mp_replace_third = /*...*/; @@ -414,6 +497,8 @@ using R3 = mp_replace_second; // mp_list` replaces the third element of the list `L` with `T`. That is, `mp_replace_third, T>` is an alias for `L`. +Supports value lists as `L` under {cpp}17. In that case, `mp_replace_third, T>` is `L`. + .Using mp_replace_third with std::tuple ``` using L1 = std::tuple; @@ -426,6 +511,12 @@ using L2 = mp_list; using R2 = mp_replace_third; // mp_list; ``` +.Using mp_replace_third with mp_list_v +``` +using L4 = mp_list_v<1, 2, 3, 4>; +using R4 = mp_replace_third; // mp_list_v<1, 2, false, 4>; +``` + ## mp_transform_front template class F> using mp_transform_front = @@ -433,6 +524,8 @@ using R2 = mp_replace_third; // mp_list` replaces the first element `T1` of the list `L` with `F`. +Supports value lists as `L` under {cpp}17. In that case, the replacement is `F>::value`. + ## mp_transform_front_q template using mp_transform_front_q = @@ -461,6 +554,8 @@ As `mp_transform_first`, but takes a quoted metafunction. `mp_transform_second` replaces the second element `T2` of the list `L` with `F`. +Supports value lists as `L` under {cpp}17. In that case, the replacement is `F>::value`. + ## mp_transform_second_q template using mp_transform_second_q = @@ -475,6 +570,8 @@ As `mp_transform_second`, but takes a quoted metafunction. `mp_transform_third` replaces the third element `T3` of the list `L` with `F`. +Supports value lists as `L` under {cpp}17. In that case, the replacement is `F>::value`. + ## mp_transform_third_q template using mp_transform_third_q =