The new C++11 (OK it's been a few years now) meaning of the 'auto' keyword is amazing !
'Auto' has been around for decades but nobody, including me, has ever really used it.
So when I saw this code I thought I was looking at some weird new language.
As one SO poster said, "it felt fun again, like using Python or something":
https://stackoverflow.com/questions/757 ... s-it-magic
Instead of this:
Code: Select all
for(someclass:iterator it = someinstance.begin(); it != someinstance.end(); ++it)
{
const somestruct& = it->second;
...
}
Code: Select all
for(auto it : someinstance)
{
const somestruct& = it.second;
}
Code: Select all
somereturnstruct someclass::somemethod(int someparam)
{
}
Code: Select all
auto someclass::somemethod(int someparam) -> somereturnstruct
{
}