#include #include #include #include #include #include using namespace std; // All the containers support iterators. // There are many types of iterators -- forward, reverse, const, ... void dumpString(const string s) { for (string::const_iterator it = s.begin(); it != s.end(); it++ ) { cout << *it << ' '; } cout << endl; } void dumpVec(const vector v) { for (vector::const_iterator it = v.begin(); it != v.end(); it++ ) { cout << *it << ' '; } cout << endl; } void dumpDeque(const deque d) { for (deque::const_iterator it = d.begin(); it != d.end(); it++ ) { cout << *it << ' '; } cout << endl; } void dumpList(const list l) { for (list::const_iterator it = l.begin(); it != l.end(); it++ ) { cout << *it << ' '; } cout << endl; } void dumpForwardList(const forward_list fl) { for (forward_list::const_iterator it = fl.begin(); it != fl.end(); it++ ) { cout << *it << ' '; } cout << endl; } void dumpArray(const array a) { for (array::const_iterator it = a.begin(); it != a.end(); it++ ) { cout << *it << ' '; } cout << endl; } void dumpNativeArray(const int a[], unsigned int size) { for (unsigned int i=0; i stringVec = {"one", "two", "three"}; deque intDeque = {1, 2, 3}; list floatList = {1.0, 2.0, 3.0}; forward_list doubleForwardList = {1.0, 2.0, 3.0}; int nativeArray[3] = {1, 2, 3}; //-------------------------------------------- // Call methods to print container contents //-------------------------------------------- dumpString(str); dumpVec(stringVec); dumpDeque(intDeque); dumpList(floatList); dumpForwardList(doubleForwardList); dumpNativeArray(nativeArray, 3); return 0; }