Add mp_list_c, mp_from_sequence

This commit is contained in:
Peter Dimov
2017-10-14 18:20:29 +03:00
parent a7485736c7
commit 018d71bb72
7 changed files with 105 additions and 5 deletions

View File

@@ -297,6 +297,17 @@ As `mp_product`, but takes a quoted metafunction.
Same as `mp_drop_c`, but with a type argument `N`. `N::value` must be a nonnegative number.
## mp_from_sequence<S>
template<class S> using mp_from_sequence = /*...*/
`mp_from_sequence` transforms an integer sequence produced by `make_integer_sequence` into an `mp_list`
of the corresponding `std::integral_constant` types. Given
template<class T, class... I> struct S;
`mp_from_sequence<S<T, I...>>` is an alias for `mp_list<std::integral_constant<T, I>...>`.
## mp_iota_c<N>
template<std::size_t N> using mp_iota_c = /*...*/;

View File

@@ -21,6 +21,18 @@ http://www.boost.org/LICENSE_1_0.txt
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.
## mp_list_c<T, I...>
template<class T, T... I> using mp_list_c =
mp_list<std::integral_constant<T, I>...>;
`mp_list_c` produces an `mp_list` of the `std::integral_constant` types corresponding to its integer template arguments.
.Using mp_list_c
```
using L1 = mp_list_c<int, 2, 3>; // mp_list<mp_int<2>, mp_int<3>>
```
## mp_is_list<L>
template<class L> using mp_is_list = /*...*/;