On Monday, 26 March 2018 at 21:17:10 UTC, jmh530 wrote:
On Sunday, 25 March 2018 at 21:26:57 UTC, aliak wrote:
Hi, I have this optional type I'm working on and I've run in
to a little snag when it comes to wrapping an immutable.
Basically what I want is for an Optional!(immutable T) to
still be settable to "some" value or "no" value because the
Optional wrapper itself is mutable.
[snip]
You might look at the source for std.typecons.Nullable. They
use an inout constructor.
Unfortunately
Nullable!(inout int) b = 3;
produces that compiler error. This seems more a case on how T is
stored than about construction in particular. Was interesting to
see a use case for hasElaborateAssign though!
By the by, how come inout has to be stack based and
const/immutable/mutable doesn't? Isn't inout just one of those
depending on context?
Cheers,
- Ali