Added missing array_get method for numeric_list

This commit is contained in:
Benoit Steiner 2016-11-26 11:26:07 -08:00
parent 7ad37606dd
commit 7fe704596a

View File

@ -123,6 +123,10 @@ template<typename a, typename... as> struct get<0, type_lis
template<typename T, int n, T a, T... as> struct get<n, numeric_list<T, a, as...>> : get<n-1, numeric_list<T, as...>> {};
template<typename T, T a, T... as> struct get<0, numeric_list<T, a, as...>> { constexpr static T value = a; };
template<std::size_t n, typename T, T a, T... as> constexpr inline const T array_get(const numeric_list<T, a, as...>& l) {
return get<(int)n, numeric_list<T, a, as...>>::value;
}
/* always get type, regardless of dummy; good for parameter pack expansion */
template<typename T, T dummy, typename t> struct id_numeric { typedef t type; };