Thread overview
[Issue 13728] std.conv.to for POD structs
Dec 17, 2014
John Colvin
Dec 17, 2022
Iain Buclaw
November 13, 2014
https://issues.dlang.org/show_bug.cgi?id=13728

--- Comment #1 from bearophile_hugs@eml.cc ---
"data.to!Foo" is also more DRY, this helps avoid some bugs if later you change the definition of Foo.

--
December 17, 2014
https://issues.dlang.org/show_bug.cgi?id=13728

John Colvin <john.loughran.colvin@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |john.loughran.colvin@gmail.
                   |                            |com

--- Comment #2 from John Colvin <john.loughran.colvin@gmail.com> ---
Why not non-POD structs and classes too?

Also, what do you think about situations where only a few of the members are set:

struct A { int a, b, c; }
auto a = A(3, 4);

is completely valid, but would you want to allow

auto a = [3, 4].to!A;

?

--
December 17, 2014
https://issues.dlang.org/show_bug.cgi?id=13728

--- Comment #3 from bearophile_hugs@eml.cc ---
(In reply to John Colvin from comment #2)
> Why not non-POD structs and classes too?

To keep this Enhancement simple and well defined. Further extensions and enhancements are possible later.


> Also, what do you think about situations where only a few of the members are set:
> 
> struct A { int a, b, c; }
> auto a = A(3, 4);
> 
> is completely valid, but would you want to allow
> 
> auto a = [3, 4].to!A;
> 
> ?

Seems possible, but also adds complexity to the proposal, so better to keep things simple at first.

--
December 17, 2022
https://issues.dlang.org/show_bug.cgi?id=13728

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P1                          |P4

--