#include <iostream>
template< typename T, T... VALUES > struct seq_c {};
template< typename T, T... > struct size ;
template< typename T, T... VALUES > struct size< seq_c< T, VALUES...> >
{ enum { value = sizeof...(VALUES) } ; } ;
template< typename T, T V, typename U > struct push_front {} ;
template< typename T, T V, T... VALUES > struct push_front< T, V, seq_c< T, VALUES...> >
{ typedef seq_c< T, V, VALUES... > type ; } ;
template< typename T > struct pop_front {} ;
template< typename T, T V, T... VALUES > struct pop_front< seq_c< T, V, VALUES...> >
{ typedef seq_c< T, VALUES...> type ; } ;
template< typename T > struct sum ;
template< typename T > struct sum < seq_c<T> > { static constexpr T value = T() ; } ;
template< typename T, T V, T... VALUES > struct sum< seq_c< T, V, VALUES...> >
{ static constexpr T value = V + sum< seq_c< T, VALUES... > >::value ; } ;
// .. etc
int main()
{
using ten_to_fifteen = seq_c< int, 10, 11, 12, 13, 14, 15 > ;
std::cout << "size of ten_to_fifteen: " << size<ten_to_fifteen>::value
<< " sum: " << sum<ten_to_fifteen>::value << '\n' ;
using nine_to_fifteen = push_front< int, 9, ten_to_fifteen >::type ;
std::cout << "size of nine_to_fifteen: " << size<nine_to_fifteen>::value
<< " sum: " << sum<nine_to_fifteen>::value << '\n' ;
using eleven_to_fifteen = pop_front< ten_to_fifteen >::type ;
std::cout << "size of eleven_to_fifteen: " << size<eleven_to_fifteen>::value
<< " sum: " << sum<eleven_to_fifteen>::value << '\n' ;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgoKdGVtcGxhdGU8IHR5cGVuYW1lIFQsIFQuLi4gVkFMVUVTICA+IHN0cnVjdCBzZXFfYyB7fTsKCnRlbXBsYXRlPCB0eXBlbmFtZSBULCBULi4uID4gc3RydWN0IHNpemUgOwp0ZW1wbGF0ZTwgdHlwZW5hbWUgVCwgVC4uLiBWQUxVRVMgPiBzdHJ1Y3Qgc2l6ZTwgc2VxX2M8IFQsIFZBTFVFUy4uLj4gPgp7IGVudW0geyB2YWx1ZSA9IHNpemVvZi4uLihWQUxVRVMpIH0gOy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