Generic Programming with C++ Template
■ このスレッドは過去ログ倉庫に格納されています
0576VC6に乗せたい
NGNGtemplate <class TList>
struct Length
{
enum { value = 1 + Length<TList::Tail>::value };
};
template <> struct Length<NullType>
{
enum { value = 0 };
};
template <class TList, unsigned int i>
struct TypeAt
{
template<int cnt>
struct isEnd
{
typedef typename TypeAt<TList::Tail, cnt-1>::Result type;
};
template<> struct isEnd<0>
{
typedef typename TList::Head type;
};
typedef typename isEnd<i>::type Result;
};
こういう風に書き換えればTypeListを使うことができるようになった。
既出ならスマソ
■ このスレッドは過去ログ倉庫に格納されています