-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 11/11/2011 08:59 AM, Joe Buck wrote:
> On Thu, Nov 10, 2011 at 10:04:34PM -0800, Gabriel Dos Reis wrote:
>> On Thu, Nov 10, 2011 at 10:12 AM, Jonathan Wakely
>> <jwakely....@gmail.com> wrote:
>> 
>>> Adding this to GCC seems like a total waste of time, write a
>>> dwarf processor that dumps the info you want.
>>> 
>> 
>> Agreed.
>> 
>> I suspect there is a misunderstanding of what 'auto' means in
>> C++. Furthermore, I think the step is completely backward.
> 
> Yes, the reason I'm delighted with auto is that there are cases
> where I do not want to know the type (or I want to write generic
> code that will work with different kinds of containers).  For
> 
> std::multimap<Foo,Bar> amap;
> 
> when I write
> 
> auto ipair = amap.equal_range(key); for (auto iter = ipair.first;
> iter != ipair.second; ++iter) do_something_with(iter->first,
> iter->second);
> 
> I explicitly do not want to know the details of the ridiculously
> hairy type of ipair.  If you want to know, it is
> 
> std::pair<std::multimap<Foo,Bar>::iterator,std::multimap<Foo,Bar>::iterator>
>
>  and that's with the defaulted template parameters omitted.

Sorry to jump in....
But it is when you write
auto ipair = amap.equal_range(key);
that you may want to know that this type is a pair and that you can
write ipair.first and ipair.second.

Of course equal_range is not the best example, but I can very well
imagine that with the generalization of auto use and with third party
libraries it might become very difficult/boring to track the actual
return type of a function (imagine a serie of functions all using auto
as return type)....

        Theo.


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk6+NMcACgkQEr8WrU8nPV0B/ACgrXULv56/t8LB8sPlIgc3Le/z
fHkAn2+jXqM6L/vauoJe0+XcVYk/6yAe
=184J
-----END PGP SIGNATURE-----

Reply via email to