break;
case 1: // Add node
test = new int(76543);
- my_collection_of_ints.add_node(test);
+ if (!my_collection_of_ints.append(*test))
+ cerr << "Error: insert failed" << endl;
break;
case 2: // Remove node
+ if (!my_collection_of_ints.remove())
+ cerr << "Error: remove failed" << endl;
break;
case 3: // List using forward Iterator
- cout << "size = " << my_collection_of_ints.get_size();
- for (int i : my_collection_of_ints) // XXX: C++11 'range for' automagically uses the 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;