#include <drlibs/doublelist.dr.h>#include <iostream>#include <string>using namespace std;/* This simple function will be used to print the list of strings. */void echo (string &data) {
cout << data << endl;}/* The parameters taken by the program will be used to feed the lists. */int main (int counter, char **params) {/* A list as a pointer to hold the parameters. */
DoubleList<string> *strlist = new DoubleList<string>;/* Another list of integers to hold parameters' sizes. */
DoubleList<int> sizes;/* Feeding the lists. */
for (int i=0; i<counter; i++) {
strlist->add (params [i]);
sizes.add (strlen(params [i]));
}
cout << "Sizes gotten:" << endl;/* Printing all the sizes one by one. */
sizes.rewind ();
for (int i=0; i<sizes.length (); i++) {
cout << sizes.get () << endl;
sizes.seekNext ();
}
cout << "Parameters gotten:" << endl;/* Using one of the iterative methods. */
strlist->listDo (echo);
cout << "Sizes again:" << endl;/* The same printing of sizes, but with a little difference. */
sizes.rewind ();
for (int i=0; i<sizes.length (); i++) {
cout << sizes.getJump () << endl;
}
cout << endl;
return 0;}