vector<X,A>& vector<X,A>::operator=(const vector<X,A>& kqrVector);
#include <vector>
vector<X,A>& vector<X,A>::operator=(vector<X,A>&& qrrVector);
#include <iostream> #include <vector> int main() { using namespace std; // Create a vector instance vector<char> qV; qV.push_back('X'); qV.push_back('o'); qV.push_back('a'); qV.push_back('X'); qV.push_back('.'); qV.push_back('n'); qV.push_back('e'); qV.push_back('t'); vector<char> qCopy; qCopy.push_back('A'); qCopy.push_back('B'); qCopy.push_back('C'); // Output the vector before the assignment vector<char>::iterator qIter; cout << "Vector before = "; for (qIter = qCopy.begin(); qIter != qCopy.end(); ++qIter) { cout << *qIter; } cout << endl; cout << "Copy the vector with the assignment operator" << endl; qCopy = qV; // Output the vector after the assignment cout << "Vector after = "; for (qIter = qCopy.begin(); qIter != qCopy.end(); ++qIter) { cout << *qIter; } cout << endl; // Keep the window open cin.get(); return 0; }
© 20072025 XoaX.net LLC. All rights reserved.