1
0
forked from boostorg/mp11

Add an offset parameter to mp_from_sequence

This commit is contained in:
Peter Dimov
2023-05-14 03:39:39 +03:00
parent 773ec9b8b2
commit b7da04c594
3 changed files with 51 additions and 5 deletions

View File

@@ -308,20 +308,20 @@ template<class L, std::size_t N> using mp_drop_c = typename detail::mp_drop_impl
template<class L, class N> using mp_drop = mp_drop_c<L, std::size_t{ N::value }>;
// mp_from_sequence<S>
// mp_from_sequence<S, F>
namespace detail
{
template<class S> struct mp_from_sequence_impl;
template<class S, class F> struct mp_from_sequence_impl;
template<template<class T, T... I> class S, class U, U... J> struct mp_from_sequence_impl<S<U, J...>>
template<template<class T, T... I> class S, class U, U... J, class F> struct mp_from_sequence_impl<S<U, J...>, F>
{
using type = mp_list<std::integral_constant<U, J>...>;
using type = mp_list_c<U, (F::value + J)...>;
};
} // namespace detail
template<class S> using mp_from_sequence = typename detail::mp_from_sequence_impl<S>::type;
template<class S, class F = mp_int<0>> using mp_from_sequence = typename detail::mp_from_sequence_impl<S, F>::type;
// mp_iota(_c)<N>
template<std::size_t N> using mp_iota_c = mp_from_sequence<make_index_sequence<N>>;