1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
|
namespace utils
{
template <size_t pos, class T, T ... args>
struct getv;
template <size_t pos, class T, T t1, T ... args>
struct getv<pos, T, t1, args...>
{
static const T value = pos ? getv<pos - 1, T, args...>::value : t1;
};
}
template <size_t ... sizes>
struct A
{
static const size_t s0 = sizeof...(sizes) > 0 ? utils::getv<0, size_t, sizes...>::value : 0;
static const size_t s1 = sizeof...(sizes) > 1 ? utils::getv<1, size_t, sizes...>::value : 0;
static const size_t s2 = sizeof...(sizes) > 2 ? utils::getv<2, size_t, sizes...>::value : 0;
}; |
Partager