STL/algorithm/copy
Материал из Wiki.crossplatform.ru
Версия от 12:59, 24 января 2012; ViGOur (Обсуждение | вклад)
Печать всех элементов коллекции с помощью std::copy
#include <iostream> #include <algorithm> #include <vector> int main() { std::vector<int> coll; for( int n = 1; n < 16; ++n) coll.push_back( n); std::copy( coll.begin(), coll.end(), std::ostream_iterator<int>(std::cout, " ") ); return 0; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15