Reference to an object disregarding mutation - what's the trick?
    Steve Teale 
    steve.teale at britseyeview.com
       
    Mon May 28 10:05:52 PDT 2007
    
    
  
OK, so I'm in a typical tree situation:
int n = node.parent.nodelist.length;
node.parent.nodelist.length = n+1;
   // p.s. why can't I say node.parent.nodelist.length++ - doesn't work
   // other fluff with node.parent.nodelist
node.parent.nodelist[n] = x;
For brevity I want to be able to say:
Node[] t = node.parent.nodelist;
int n = t.length;
t.length = n+1;
.....
But as soon as I modify t it becomes a separate object.
OK, I can use with, but how do I get the semantics I'd get with a plain old pointer to the object?
    
    
More information about the Digitalmars-d
mailing list