Forward references

Jiyan jiyan at jiyan.info
Sun Feb 25 21:25:45 UTC 2018


Hi,
is there any document or text describing forward references?
It is kinda strange, i implemented a list structure which is 
kinda like this:

struct list(T)
{
private:

struct node
{
T val;
node* next;
node* prev;
}

node* head;
node* last;
size_t size;

  .....
}

The thing is when i implement following struct:

struct Tre
{
list!Tre a;
}

theoretically it should be constructable. But it gives me out a 
compiler error about Forward reference. Ok maybe the compiler at 
this point cant do that but ...

The strange thing is i somehow managed earlier without knowing to 
do exactly this in a much more complicated struct.
Can somebody enlighten me about this?







More information about the Digitalmars-d-learn mailing list