Ternary Search Trees

Fawzi Mohamed fmohamed at mac.com
Thu Apr 16 13:42:31 PDT 2009


On 2009-04-16 18:19:36 +0200, bearophile <bearophileHUGS at lycos.com> said:

> [...]
> struct TST(T) {
>     TST* left, right;
>     union {
>       TST* mid;
>       int index;
>     }
>     T item;
> 
>     // methods here
> }
> 
> Note that inside there you don't need TST!(T)*, TST* is probably 
> enough, but I don't know why yet.

struct TST(T){ ... }

is syntactic sugar for

template TST(T){
  struct TST{ ...}
}

so TST in the structure refers by default to the struct itself.

Fawzi




More information about the Digitalmars-d mailing list