C++17 Init statement for if/switch

Enamex via Digitalmars-d digitalmars-d at puremagic.com
Thu Aug 17 06:11:51 PDT 2017


On Wednesday, 16 August 2017 at 14:19:59 UTC, SrMordred wrote:
> On Tuesday, 15 August 2017 at 21:05:09 UTC, bachmeier wrote:
>> On Tuesday, 15 August 2017 at 20:31:50 UTC, Jonathan Marler 
>> wrote:
>>
>>> Without alot of usage, it will just be an esoteric construct 
>>> that looks confusing to the average developer.
>>
>> That is correct. After a while it gets tiring to see a 
>> neverending stream of complexity added to the language while 
>> things that would actually help (like IDE support) do not get 
>> any attention. As a general rule, if it's being added to C++, 
>> it's probably a bad idea.
>
> 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).


More information about the Digitalmars-d mailing list