implicite deref on array element access? (indexing)

Jonathan M Davis jmdavisProg at gmx.com
Fri Feb 25 18:14:12 PST 2011


On Friday, February 25, 2011 07:15:52 spir wrote:
> Hello,
> 
> I thought it worked, just like implicite deref on (struct, class) member
> access. But I cannot have it work:
> 
>      auto a = [1,2,3];
>      auto pa = &a;
>      writeln((*pa)[2]);      // ok
>      writeln(pa[2]);         // segfault
> 
> Denis

The _only_ time that dereferencing is done automatically in D is with the dot 
operator.

- Jonathan M Davis


More information about the Digitalmars-d-learn mailing list