break;
case 3: // List using forward Iterator
cout << "size = " << my_collection_of_ints.get_size() << endl;
+
+ /* the traditional style of iterator loop
+ for (GSCTI<int, DataStructure_ArrayDynamic>::_iterator end = my_collection_of_ints.end(),
+ i = my_collection_of_ints.begin();
+ i != end;
+ ++i)
+ {
+ cout << "Data = " << *i << endl;
+ }
+ */
+
+ /* the modern range-based for loop
+ * see http://en.cppreference.com/w/cpp/language/range-for
+ */
for (auto i : my_collection_of_ints) // XXX: C++11 'range for' automagically uses the iterator
{
- cout << "Node = " << i << endl;
+ cout << "Data = " << i << endl;
}
+
break;
case 4: // List using reverse Iterator
break;