Last active
November 27, 2016 23:20
-
-
Save picanumber/c044de80fb9646f01d627af824d232f1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace detail | |
{ | |
template <class...> struct integer_range; | |
template <class T, class Ofst, T... Vals> | |
struct integer_range<T, Ofst, std::integer_sequence<T, Vals...>> | |
{ | |
using type = std::integer_sequence<T, (Ofst::value + Vals)...>; | |
}; | |
} | |
template <class T, T I1, T I2, class Check = std::enable_if_t<I1 <= I2>> | |
using make_integer_range = typename detail::integer_range<T, | |
std::integral_constant<T, I1>, std::make_integer_sequence<T, I2 - I1>>::type; | |
template <std::size_t I1, std::size_t I2> | |
using make_index_range = make_integer_range<std::size_t, I1, I2>; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment