Immutable objects and constructor ?
Kagamin via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Fri May 20 10:35:01 PDT 2016
On Friday, 20 May 2016 at 16:09:54 UTC, chmike wrote:
> But I now met another error in my main(). I can't assign the
> immutable object to a mutable reference.
>
> Info x1 = MyInfos.one;
>
> Is it possible to define a mutable reference to an immutable
> instance ?
Sort of possible with a library solution:
import std.typecons;
auto x1 = rebindable(MyInfos.one);
More information about the Digitalmars-d-learn
mailing list