// Demonstrating generic reverse algorithm on a list. #include #include #include #include list lst(char* s) // Return list containing the characters of s // (not including the terminating null). { list x; while (*s != '\0') x.push_back(*s++); return x; } int main() { cout << "Demonstrating generic reverse algorithm on a list" << endl; list list1 = lst("mark twain"); reverse(list1.begin(), list1.end()); assert(list1 == lst("niawt kram")); }