On Tue, 15 Mar 2011 20:32:43 -0400, Andrej Mitrovic <[email protected]> wrote:

On 3/15/11, dsimcha <[email protected]> wrote:
Something that has basically that effect is allowed, just not with that
syntax:

struct slist_node(T)
{
     slist_node base;
     alias base this;

     T data;
}


Shouldn't base be a pointer? You'll get errors with that code.

The problem is the name. The original code had a simple un-parameterized slist_node type:

struct slist_node
{
   slist_node * next;
}

So when David wrote his response, he meant *that* struct. However, the way he named his parameterized struct, it actually refers to itself.

This is the one I wrote, which should be what the OP wanted:

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

   T data;
}

-Steve

Reply via email to