Insert characters into vector. An iterator to the inserted object is returned
#include <iostream>
#include <vector>
using namespace std;
void show(const char *msg, vector<char> vect);
int main() {
vector<char> v;
vector<char>::iterator itr;
itr = v.begin();
itr = v.insert(itr, 'A');
itr = v.insert(itr, 'B');
v.insert(itr, 'C');
return 0;
}
void show(const char *msg, vector<char> vect) {
vector<char>::iterator itr;
cout << msg << endl;
for(itr=vect.begin(); itr != vect.end(); ++itr)
cout << *itr << endl;
}
Related examples in the same category