by CountHackulus · 15y ago · 0 comments
Let's look at the equivalent C++98 loop:
int i = -1;
for(std::vector<int>::iterator iter = v.begin(); iter != v.end(); ++iter)
{
if(*iter > x && *iter < y)
{
i = *iter;
break;
}
}
It's not only much more verbose, but the types need to be expressly written, and what's going on isn't immediately obvious from the function name.No, C++ will never win a beauty contest (I'd vote for D or Haskell personally), but it's great for expressibility, and the new C++11 changes make things more concise.
When you compare the new code to the C++98 one, it looks like a great improvement. But isn't that because C++98 simply sucked even more? As you say, when you compare it to languages like Haskell, even the new C++11 leaves something to be desired.