/* -*- C++ -*- */ /************************************************************************* * Copyright(c) 1995~2005 Masaharu Goto (root-cint@cern.ch) * * For the licensing terms see the file COPYING * ************************************************************************/ #include #include #include <_list.h> // problem in precompiled list class and cint #include #include list vec(char* s) { list x; while(*s != '\0') { x.push_back(*s++); } return x; } ostream& operator<<(ostream& os,list& x) { list::iterator p=x.begin(); do { os << *p++ ; //os << ((int)(*p++)) << ' '; } while(p!=x.end()); return(os); } int main() { //test() ; exit(); cout << "Using reverse algorithm with a list" << endl; list list1 = vec("mark twain"); cout << list1 << endl; reverse(list1.begin(),list1.end()); cout << list1 << endl; assert(list1 == vec("niawt kram")); if(list1 == vec("niawt kram")) cout << "true" << endl; else cout << "false" << endl; } test() { list list1 = vec("mark twain"); list list2 = vec("mark twain"); cout << list1 << endl; cout << list2 << endl; }