Why the need for an only const ref?

Christopher Wright dhasenan at gmail.com
Mon Dec 3 06:14:59 PST 2007


Janice Caron wrote:
> Ooh, ooh - I just figured out - we DO have head constness in D after
> all! You want a mutable buffer you can't move? No problem! Here's how
> it's done...
> 
>     private char[] buffer_ = new char[MAXBUFSIZE];
>     char[] buffer() { return buffer_; }
> 	
>     buffer[0] = '+'; /* OK */
>     buffer ~= '+'; /* Error */

Right...now just make sure your modules are small. People using this 
tactic don't have many friends.



More information about the Digitalmars-d mailing list