Nested Functions in C++

Gabriel Dos Reis gdr@cs.tamu.edu
Sat Oct 23 15:10:00 GMT 2004


Joe Buck <Joe.Buck@synopsys.COM> writes:

[...]

| Consider a feature like the new use of "auto", championed by Bjarne
| himself. 

If things go well, we may have to vote for inclusion in the working
paper in 6 months (the decltype part may have to wait another 6 months). 

| There appear to be some details that have not yet been worked
| out, but maybe the best way to iron out the remaining issues is to have
| a trial implementation to play with.
| 
| This is the one that lets you write
| 
| func (std::multimap<std::string, std::string>& amap, std::string key) {
| 
|      auto iter_pair = amap.equal_range(key);
|      ...
| }
| 
| instead of
| 
| func (std::multimap<std::string, std::string>& amap, std::string key) {
| 
|      std::pair<std::multimap<std::string, std::string>::iterator,
|                std::multimap<std::string, std::string>::iterator>
| 	  iter_pair = amap.equal_range(key);
|      ...
| }
| 
| I want that!  I wanted it years ago.

And it was implemented in Cfront as early as 1983; it was removed, when
some users considered it to be going too far.  Seems like we're back
to the future :-)

-- Gaby



More information about the Gcc mailing list