Joe Armstrong said a word:
The problem with object-oriented programming languages is that it always comes with all the implicit environments it needs. You want a banana, but you get a gorilla with a banana, and the whole jungle.
Obviously, this complicates the simple question. We do not deny that there is some code in this world that cannot be simplified. For those code that can be simplified, we hope we don't complicate it. If you are such a person, there is no reason not to use c++11. Here's a demonstration of how c++11 miraculously simplifies the code.
Let's say the following code is used to determine if there is a string within the container that meets our requirements:
vector<string>::const_iterator cit = vs.cbegin();for (; cit != vs.end(); ++cit) { if (lookForParttern(*cit)) return true;}return false;
For c++11, this code is normal. With C++11, it's easy to write the following code:
for (auto cit = vs.cbegin(); cit != vs.end(); ++cit) { if (lookForParttern(*cit)) return true;}return false;
For the inside of the thing or put it in better, this code than the previous paragraph, looks elegant. C + + has a range-for, so we can also write this:
for (auto& x : vs) { if (lookForParttern(x)) return true;}return false;
Found a lot of brevity. This is not enough, we can also use the algorithm to make the code more concise:
return find_if(cbegin(vs), cend(vs), lookForParttern) != cend(vs);
Well, it becomes a line of code. Frankly speaking, Cbegin,cend is very annoying to write more. We can eliminate it by using the range algorithm:
return find_if(vs, lookForParttern) != cend(vs);
Compared with the first piece of code, not only the code is much shorter, but also more readable. The c++11 greatly increases productivity without reducing operational efficiency. You can throw the java,c# aside.
C++11, make simple things simple