What's the best way to iterate over two or more containers simultaneously
问题 C++11 provides multiple ways to iterate over containers. For example: Range-based loop for(auto c : container) fun(c) std::for_each for_each(container.begin(),container.end(),fun) However what is the recommended way to iterate over two (or more) containers of the same size to accomplish something like: for(unsigned i = 0; i < containerA.size(); ++i) { containerA[i] = containerB[i]; } 回答1: Rather late to the party. But: I would iterate over indices. But not with the classical for loop but