Multiple implicit type converters

Dave Akers via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Sep 11 12:51:07 PDT 2015


On Friday, 11 September 2015 at 19:34:46 UTC, Bahman Movaqar 
wrote:
> On Friday, 11 September 2015 at 16:33:52 UTC, Meta wrote:
>> The only ways to get implicit conversion between two types in 
>> D are through `alias this`, inheritance, or implementing an 
>> interface.
>
> That's enough for me, I suppose.
> I am thinking of having a family of functions in my 
> structs/classes as `as` family, such as `asDouble`, `asFooBar`.

Would it be possible to create it as an 'as' template?



More information about the Digitalmars-d-learn mailing list