/* -*- C++ -*- */ /************************************************************************* * Copyright(c) 1995~2005 Masaharu Goto (root-cint@cern.ch) * * For the licensing terms see the file COPYING * ************************************************************************/ #include #include #include #include #include vector vec(char* s) { vector x; while(*s != '\0') { x.push_back(*s++); } return x; } ostream& operator<<(ostream& os,vector& x) { vector::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 vector" << endl; vector vector1 = vec("mark twain"); cout << vector1 << endl; reverse(vector1.begin(),vector1.end()); cout << vector1 << endl; assert(vector1 == vec("niawt kram")); if(vector1 == vec("niawt kram")) cout << "true" << endl; else cout << "false" << endl; } test() { vector vector1 = vec("mark twain"); vector vector2 = vec("mark twain"); cout << vector1 << endl; cout << vector2 << endl; }