Is there a standard way to define to for user-defined types?

Jonathan M Davis jmdavisProg at gmx.com
Sun Jun 19 20:47:39 PDT 2011


On 2011-06-19 20:40, Andrej Mitrovic wrote:
> Ah, this is what I did found:
> 
> Line 665 in std.conv:
> 
> /**
> Object-_to-non-object conversions look for a method "to" of the source
> object.
> */
> 
> So I guess this can be expanded upon to cover object-to-object
> conversions, maybe?

Hmmm. I wonder why it's restricted to converting to primitive types. I can't 
think of any reason why it would, but presumably whoever wrote it had a good 
reason for doing so. Seeing that though, my first reaction would be to make it 
work with object-to-object conversions as well.

- Jonathan M Davis


More information about the Digitalmars-d mailing list