Transitive const sucks

Regan Heath regan at netmail.co.nz
Tue Sep 11 03:15:48 PDT 2007


Regan Heath wrote:
> For the first I would suggest a new syntax like:
> 
> class Foo { int a; }
> const(Foo&) pFoo;  //pFoo cannot change, pFoo.a can

Actually, correction, this should probably be:

const(&Foo) pFoo;  //pFoo cannot change, pFoo.a can

The position of & in this case is important becase we don't want it 
confused with reference types but rather we're saying:

"the reference/pointer/address of this is const"



More information about the Digitalmars-d mailing list