Implicit conversion without alias this?

2016-06-03 Thread maik klein via Digitalmars-d-learn
I have my own version of Algebraic struct Ok(T){ T value; } struct Err(E){ E value; } auto ok(T)(auto ref T value){ return Ok!T(value); } auto err(E)(auto ref E err){ return Err!E(err); } alias Result(T, E) = Algebraic!(Ok!T, Err!E); I have a constructor and opAssign which al

Re: Implicit conversion without alias this?

2016-06-03 Thread Jonathan M Davis via Digitalmars-d-learn
On Friday, June 03, 2016 16:12:50 maik klein via Digitalmars-d-learn wrote: > Any ideas? Well, alias this is the only way that D supports any kind of implicit conversions for user-defined types. So, if you want to have an implicit conversion for your type, you're going to have to figure out how to