[Issue 5719] [patch] std.conv.to should support structs with custom converters in addition to objects

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Oct 9 10:07:36 PDT 2011


http://d.puremagic.com/issues/show_bug.cgi?id=5719



--- Comment #4 from Rob Jacques <sandford at jhu.edu> 2011-10-09 10:06:45 PDT ---
(In reply to comment #3)
> (In reply to comment #2)
> > https://github.com/D-Programming-Language/phobos/pull/118
> > https://github.com/D-Programming-Language/phobos/pull/119
> > https://github.com/D-Programming-Language/phobos/pull/122
> 
> The three pull requests are already merged, and now std.conv.to supports both
> two kinds of custom conversions:
> 
> 1) object to non-object conversion with opCast
>    to!T(s)
>    --> s.opCast!T()
> 
> 2) non-object to object conversion with construction
>    to!T(s)
>    --> new T(s) // if T is class
>        T(s)     // if T is struct
> 
> Today, is this a closable issue?

By 'object' do you mean both classes and structs? Specifically, these
conversions seem to be missing:

3) non-object to non-object conversion with opCast
    to!T(s)
    --> s.opCast!T()

4) non-object to non-object conversion with construction
   to!T(s)
       T(s)     // if T is struct

But this might be a case of semantics, not implementation. (I generally don't
refer to structs as 'objects')

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list