Template return values?
Era Scarecrow
rtcvb32 at yahoo.com
Wed Dec 5 19:27:09 PST 2012
On Wednesday, 5 December 2012 at 19:32:03 UTC, Jonathan M Davis
wrote:
> Yes, but that inevitably forces you to check the type in order
> to handle it correctly, which means that implicit conversion
> just doesn't work. In order for implicit conversion to work,
> you have to be able to assume that you're dealing with a
> particular type, and if you can do that, why are you using a
> Variant in the first place? Just use a common type.
I know for my own project a common type isn't possible (It's a
block of raw memory most of the time), but i do know at certain
points if it's one type or another just because of where it's at.
In order to handle all the types it ends up either being a
pointer (union for all) or use long and double and string, but
you I have to call them manually (geti, gets, getf).
Also implicit conversion only makes sense if it's a type that
can be converted to. Any user type can't be converted without
alias this or classes/interfaces.
More information about the Digitalmars-d-learn
mailing list