C++17 Init statement for if/switch

SrMordred via Digitalmars-d digitalmars-d at puremagic.com
Thu Aug 17 19:39:16 PDT 2017


On Thursday, 17 August 2017 at 13:11:51 UTC, Enamex wrote:
> On Wednesday, 16 August 2017 at 14:19:59 UTC, SrMordred wrote:
>> On Tuesday, 15 August 2017 at 21:05:09 UTC, bachmeier wrote:
>>> [...]
>>
>> There are two thinks of c++ that I miss a little on D:
>> - Structured binding
>> - Uniform initialization
>>
>> But in general, I agreed with you.
>
> Initialization in D is pretty uniform now though. What corners 
> am I missing?
>
> It's usually:
>
>     <type-or-infer> name = <constructor>(args);
>
> Structured bindings... I think C++ did it badly, actually. They 
> had the {...} syntax fr object construction that worked 
> everywhere and using the same for deconstruction would've 
> allowed for quite natural tuples, which manifest almost as 
> language-level constructs by then (with the help of 'auto' in 
> template parameters).

Nothing too serious, just miss somethings like:
void add_vec( vec2 a, vec2 b );
add_vec( {10,20}, {20,30} );



More information about the Digitalmars-d mailing list