idiomatic D: what to use instead of pointers in constructing a tree data structure?

Baz via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Jan 7 18:50:27 PST 2015


On Wednesday, 7 January 2015 at 15:04:24 UTC, Paulo  Pinto wrote:
> On Wednesday, 7 January 2015 at 15:02:34 UTC, Laeeth Isharc 
> wrote:
>> Not true. If you're using a tree structure, you *should* use
>>> pointers.
>>> Unless you're using classes, which are by-reference, in which 
>>> case you
>>> can just use the class as-is. :-)
>>
>> Thanks v much.
>>
>> I just came to that realization also when I stepped away.
>>
>> class node
>> {
>> 	string name;
>> 	node ref;
>> }
>>
>> what's wrong with the code above ?  i get an error no 
>> identifier for declarator node.  (I have not used classes 
>> much, since structs often seem to be enough for what I need to 
>> do mostly).
>
> ref is a reserved keyword.
>
> --
> Paulo

this conversation is so funny: well what's wrong with this . It's 
a keyword...
Aa Ha ha ha ha , rol.
Seriously, is it so complicated to use a D editor ? I mean with 
syntax color...



More information about the Digitalmars-d-learn mailing list