Topic: [c++std-core-27179] [std-proposals] An


Author: Bjarne Stroustrup <bjarne@stroustrup.com>
Date: Wed, 04 Mar 2015 11:14:44 -0500
Raw View

On 3/4/2015 7:49 AM, Ville Voutilainen wrote:
> On 4 March 2015 at 14:45, Faisal Vali <faisalv@gmail.com> wrote:
>>> I don't see the use-case for this feature. Why would I write
>>>
>>>      vector<auto> v = vector<int>();
>>>
>>> when it's less typing and less noise to just write
>>>
>>>      auto v = vector<int>();
>>>
>> I generally agree with the above statement - but there are some who
>> have argued that it can improve readability - and I see their point
>> too.
> That's a bad example for it. A better one is
> vector<auto> v = some_function();
> where you don't care about the exact return type of some_function,
> but you do want to ensure it's a vector. Such ensuring is indeed completely
> unnecessary for the example above where the type created is visible
> in a crystal clear fashion.
>

and then, with suitable concepts and a much-asked-for extension of
concepts to allow placement of concepts roughly wherever "auto" can be
placed:

        Container v = some_function();

and

       vector<Some_string_type> v = some_function();

--

---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-discussion+unsubscribe@isocpp.org.
To post to this group, send email to std-discussion@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-discussion/.

.