to!() conversion between objects

bearophile bearophileHUGS at lycos.com
Wed Oct 19 20:27:13 PDT 2011


Piotr Szturmaj:

> > Do you have some use case to show me?
> 
> class C
> {
>      int i;
>      string s;
> }
> 
> struct S
> {
>      string s;
>      float f;
> }
> 
> auto c = to!C(S("5", 2.5f));
> assert(c.i == 5 && c.s == "2.5");

This is an usage example, it isn't an use case.
And it looks a bit messy.

Bye,
bearophile


More information about the Digitalmars-d mailing list