mutable reference to const object

Vadim Lopatin coolreader.org at gmail.com
Thu Mar 6 09:54:34 PST 2014


On Thursday, 6 March 2014 at 15:54:13 UTC, FreeSlave wrote:
> You probably need Rebindable template from std.typecons.

Thank you! Rebindable does exactly what I need.

I'm just curious why there is no some syntax to describe the same.
E.g.
    const(Foo) foo; // mutable ref to const object
    const Foo foo;  // const ref to const object

Using of const is inconvenient w/o mutable refs.
I understand that Rebindable doesn't add overhead, but it looks a 
bit ugly.


More information about the Digitalmars-d-learn mailing list