On Tue, 15 Mar 2011 09:25:13 -0400, Jens <[email protected]> wrote:

It seems rather fundamental to be able to compose a new struct from a
given struct using inheritance. Why is this not allowed?

struct slist_node
{
    slist_node* next;
};

template <class T>
struct slist_node<T>: public slist_node
{
    T data;
};



struct slist_node
{
   slist_node* next;
}

struct slist_node_t(T)
{
   slist_node base;
   T data;
   alias base this;
}

should do the trick. But I would point out that you are better off not doing a s-list this way, since traversing will require much casting.

-Steve

Reply via email to