How to avoid inout type constructor with Optional type wrapper undoing string type
aliak
something at something.com
Mon Jul 23 19:43:01 UTC 2018
On Monday, 23 July 2018 at 19:31:42 UTC, aliak wrote:
> Ok, now I'm totally confused. Defining an extra type
> constructor makes everything work. I.e add a const one to the
> inout one:
>
> auto defined(T)(const auto ref T value) {
> return W!T(value);
> }
>
> and everything works!
>
> Can anyone say why that is?
Boh, seems other problems crop up now as doing this:
auto a = defined!(int*)(null);
produces error:
onlineapp.d(13): Error: inout constructor
onlineapp.W!(int*).W.__ctor!(int*).this creates const object, not
mutable
onlineapp.d(30): Error: template instance
`onlineapp.defined!(int*)` error instantiating
https://run.dlang.io/is/BWYxA8
More information about the Digitalmars-d-learn
mailing list