Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // тип IntList уже определён
- // реализация метафункции IntCons
- template<int Head, typename T>
- struct IntCons;
- template<int Head, int ... Ints>
- struct IntCons<Head, IntList<Ints...>>
- {
- using type = IntList<Head, Ints...>;
- };
- template<int Head>
- struct IntCons<Head,IntList<>>
- {
- using type = IntList<Head>;
- };
- // реализация метафункции Generate
- template <int, int = 0 >
- struct Generate;
- template< int Value, int IL >
- struct Generate
- {
- using type = typename IntCons<IL, typename Generate< Value - 1, IL+1 >::type >::type;
- };
- template<int IL>
- struct Generate<0, IL>
- {
- using type = IntList<>;
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement