What is the meaning of Erasing type from a typelist in c++ meta programming. Can any one suggest any simple example.
class null_typelist {};
template <class H, class T>
struct typelist
{
typedef H head;
typedef T tail;
};
template<class T1, class T2=null_typelist, class T3=null_typelist, class T4=null_typelist> struct List;
template <class T1, class T2, class T3>
struct List<T1, T2, T3, null_typelist>
{
typedef typelist<T1, typelist<T2, typelist<T3,null_typelist> > > type;
};
template <class H, class T>
class ABC< typelist<H, T> > : public ABC<T>
{
...
};
template <class H>
class ABC< typelist<H, null_typelist> >
{
...
};
struct Elements{};
struct A: Elements{};
struct B: Elements{};
struct C: Elements{};
typedef List<A,B,C>::type MyOBJ;
struct Createobject : ABC<MyOBJ>
{
...
};
int main()
{
Createobject obj;
}
Here in this case if i have to remove B from type list. is it possible to remove it ? and how i can remove type B.
From Loki's Typelist.h:
So, if a typelist
TListmentions sayint,double, andchar-Erase<TList, double>::Resultwould return a typelist for justintandchar.If you just don't understand what a typelist is, then perhaps you should post that as a separate question or ask that here as well....