Boost logo

Boost :

Subject: Re: [boost] [language] determine sence of language proposal concerning the 'default'-keyword
From: Jakob Riedle (jakob.riedle_at_[hidden])
Date: 2015-04-09 03:55:39


Gavin Lambert
> This may be a bikeshed, but why not use auto()?
>
> This would retain "auto" as "infer the appropriate type here" and "()"
> as "invoke with no parameters", together implying a constructor call.
> And it avoids overloading yet another keyword.

That's a good idea and probably way more straightforward, thanks!

Vicente J. Botet Escriba
> Note that {} means already IMPLICIT default constructor.

Of course I know of this type of initialization.
There is still a problem in readability: Are you passing some kind of empty list '{}',
or do you want to construct an object using the default ctor,
which most often leads to an initialized, that is non-empty object. => Counterintuitivity

Furthermore, there is no way to initialize an object this way,
if one ctor takes an std::initializer_list.

Gavin Lambert
> Although ultimately if you're mostly concerned about typing long names,
> then typedef is your friend.

Truly.

As it's a good idea to use 'auto()' instead, because it's the forehead of template-less type-deduction,
why not complete the set of 'auto'-deducing features?

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk