Boost logo

Boost :

Subject: Re: [boost] [language] determine sence of language proposal concerning the 'default'-keyword
From: Gavin Lambert (gavinl_at_[hidden])
Date: 2015-04-08 19:22:07


On 9/04/2015 09:31, Jakob Riedle wrote:
> since this seems to me kind of a proving ground for new C++
> library/language features I'd ask this question here.
>
> Would you recon' writing a language proposal about:
>
> using the 'default'-keyword as some standard way of calling the
> default ctor of variables.
>
> I could imagine the following use-case:
>
> void foo( some::very_long_name<some_very_long_template_param> arg = default ){
> return;
> }
>
> This would make things shorter, in the way 'auto' does it for types.

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.

It would have to de-reference intelligently when determining the
constructor to call, though.

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


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