Idea to ease tail-const class reference woes
Janice Caron
caron800 at googlemail.com
Fri Mar 21 06:56:54 PDT 2008
On 21/03/2008, Steven Schveighoffer <schveiguy at yahoo.com> wrote:
> So my idea is to include in the class data a const reference to itself.
> Then provide a way to access that const reference. In this way, tail-const
> classes become easy:
>
> C myClass = new C;
> const(C)* constClass = &myClass.constref;
>
> Does this sound reasonable?
Sounds more work than
import std.typecons;
Rebindable!(C) myClass = new myClass;
which is planned for the future. (See D2.012 change log)
More information about the Digitalmars-d
mailing list