Boost logo

Boost :

Subject: Re: [boost] [language] determine sence of language proposal concerning the 'default'-keyword
From: Andrzej Krzemienski (akrzemi1_at_[hidden])
Date: 2015-04-09 03:23:10


2015-04-08 23:31 GMT+02:00 Jakob Riedle <jakob.riedle_at_[hidden]>:

> Hello boost community,
>
>
>
> 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.
>
> You could also do it for passing parameters:
>
>
>
>
>
> foo( default );
>
>
>
>
>
> This could interact very well with boost::optional, make it more intuitive
> and easier to use:
>
>
>
>
>
> optional<int> bar( optional<some_long_type_name> arg = default ){
>
> return default;
>
> }
>
> bar( default );
>

For the particular case of std::experimental::optional, you can use the
brace notation:

optional<int> bar( optional<some_long_type_name> arg = {}){
     return default;
}

bar({});

Regards,
&rzej


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