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.

Reply via email to