Le 23/10/2012 14:27, Lars Gullik Bjønnes a écrit :
C++11 would make the code look a lot nicer, esp. thru the use of range
based for, and auto:

     std::vector<string>::iterator at = somevec.begin();
     std::vector<string>::iterator end = someved.end();
     for (; at != end; ++at) {
         ...
     }

would be replaced with:

     for (auto & s: somevec) {
         ...
     }

We already have a foreach macro that is not to bad, but we do not use it much:
foreach (string & s, somevec) {
 ...
}

This is admittedly not as nice as real C++11, but if we converted code to use it, it would be trivial later to switch to the real thing.

Concerning auto, I am still not sure that I like it.

JMarc

Reply via email to