Next: Weitere Funktionen
Up: Algorithmen
Previous: Kopieren
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
int main()
{
typedef vector<int> VectorOfInts;
VectorOfInts tip1, tip2;
tip1.push_back(45);
tip1.push_back(1);
tip1.push_back(17);
tip1.push_back(27);
copy( tip1.begin(), // Quelle start
tip1.end(), // Quelle ende
back_inserter(tip2)); // Ziel
for(unsigned int i=0; i < tip2.size(); ++i) {
cout << tip2[i] << endl;
}
}
| © 1997 Gottfried Rudorfer, C++-AG, Lehrveranstaltungen, Abteilung für Angewandte Informatik, Wirtschaftsuniversität Wien, 12/1/1998 |