#include #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.cbegin(); it != s.cend(); it++ ) { cout << *it << ' '; } cout << endl; } void dumpVec(const vector v) { for (vector::const_iterator it = v.cbegin(); it != v.cend(); it++ ) { cout << *it << ' '; } cout << endl; } void dumpDeque(const deque d) { for (deque::const_iterator it = d.cbegin(); it != d.cend(); it++ ) { cout << *it << ' '; } cout << endl; } void dumpList(const list l) { for (list::const_iterator it = l.cbegin(); it != l.cend(); it++ ) { cout << *it << ' '; } cout << endl; } void dumpForwardList(const forward_list fl) { for (forward_list::const_iterator it = fl.cbegin(); it != fl.cend(); it++ ) { cout << *it << ' '; } cout << endl; } void dumpNativeArray(const int a[], unsigned int size) { for (unsigned int i=0; i stringVec = {one, "two", "three"}; one = "two"; 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; }