uniform initialization in D (as in C++11): i{...}

Daniel Kozak via Digitalmars-d digitalmars-d at puremagic.com
Mon Apr 4 22:56:05 PDT 2016



Dne 5.4.2016 v 07:39 Timothee Cour via Digitalmars-d napsal(a):
> what's D's answer for C++11's uniform initialization [1] which allows DRY code?
>
> Could we have this:
> ----
> struct A{
>    int a;
>    int b;
> }
>
> A fun(A a, int b) {
>    if(b==1) return i{0,1};
>    else if(b==2) return i{2,3};
>    else return fun(i{3,4}, 1);
> }
> ----
>
> ...
Please no. I really don't like this on c++. Bring it this to D would be 
disaster from my POV. D is already complicated enough



More information about the Digitalmars-d mailing list