iterator vector<X,A>::emplace(const_iterator qIter, X&& xrrValue);
#include <vector>
#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');
// Output the entries, call emplace and output them again
vector<char>::iterator qIter;
cout << "V = ";
for (qIter = qV.begin(); qIter != qV.end(); ++qIter) {
cout << *qIter;
}
cout << endl;
// Call emplace
cout << "call emplace()" << endl;
qV.emplace(qV.begin(), 'Z');
cout << "V = ";
for (qIter = qV.begin(); qIter != qV.end(); ++qIter) {
cout << *qIter;
}
cout << endl;
// Keep the window open
cin.get();
return 0;
}
© 20072025 XoaX.net LLC. All rights reserved.