From: Foster B. <fos...@us...> - 2006-02-03 18:21:00
|
Update of /cvsroot/adobe-source/adobe-source/adobe/test/forest_smoke In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1031/adobe/test/forest_smoke Modified Files: main.cpp Log Message: asl 1.0.13 Index: main.cpp =================================================================== RCS file: /cvsroot/adobe-source/adobe-source/adobe/test/forest_smoke/main.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** main.cpp 6 Jan 2006 18:35:25 -0000 1.1 --- main.cpp 3 Feb 2006 18:20:48 -0000 1.2 *************** *** 11,67 **** void output(const R& f) { ! typedef typename boost::range_iterator<R>::type iterator; ! for (iterator first(boost::begin(f)), last(boost::end(f)); first != last; ++first) ! { ! for (typename iterator::difference_type i(first.depth()); i != 0; --i) ! { ! std::cout << "\t"; ! } ! if (first.edge() == adobe::forest_leading_edge) ! { ! std::cout << "<" << *first << ">" << std::endl; ! } ! else ! { ! std::cout << "</" << *first << ">" << std::endl; ! } ! } } ! int main() { ! typedef adobe::forest<std::string> forest; ! typedef forest::iterator iterator; ! std::cout << "<- default construction and insert ->" << std::endl; ! forest f; ! iterator i (f.begin()); ! i = adobe::trailing_of(f.insert(i, "grandmother")); ! { ! iterator p (adobe::trailing_of(f.insert(i, "mother"))); ! f.insert(p, "me"); ! f.insert(p, "sister"); ! f.insert(p, "brother"); ! } ! { ! iterator p (adobe::trailing_of(f.insert(i, "aunt"))); ! f.insert(p, "cousin"); ! } ! f.insert(i, "uncle"); ! ! output(adobe::depth_range(f)); ! std::cout << "<- copy construction and reverse ->" << std::endl; ! ! forest f2(f); ! iterator f2_grandmother(adobe::find(adobe::preorder_range(f2), "grandmother").base()); ! f2.reverse(adobe::child_begin(f2_grandmother), adobe::child_end(f2_grandmother)); ! ! output(adobe::depth_range(f2)); ! ! std::cout << "<- reverse iterator ->" << std::endl; ! ! output(adobe::depth_range(adobe::reverse_fullorder_range(f))); ! return 0; } --- 11,67 ---- void output(const R& f) { ! typedef typename boost::range_iterator<R>::type iterator; ! for (iterator first(boost::begin(f)), last(boost::end(f)); first != last; ++first) ! { ! for (typename iterator::difference_type i(first.depth()); i != 0; --i) ! { ! std::cout << "\t"; ! } ! if (first.edge() == adobe::forest_leading_edge) ! { ! std::cout << "<" << *first << ">" << std::endl; ! } ! else ! { ! std::cout << "</" << *first << ">" << std::endl; ! } ! } } ! int main() { ! typedef adobe::forest<std::string> forest; ! typedef forest::iterator iterator; ! std::cout << "<- default construction and insert ->" << std::endl; ! forest f; ! iterator i (f.begin()); ! i = adobe::trailing_of(f.insert(i, "grandmother")); ! { ! iterator p (adobe::trailing_of(f.insert(i, "mother"))); ! f.insert(p, "me"); ! f.insert(p, "sister"); ! f.insert(p, "brother"); ! } ! { ! iterator p (adobe::trailing_of(f.insert(i, "aunt"))); ! f.insert(p, "cousin"); ! } ! f.insert(i, "uncle"); ! ! output(adobe::depth_range(f)); ! std::cout << "<- copy construction and reverse ->" << std::endl; ! ! forest f2(f); ! iterator f2_grandmother(adobe::find(adobe::preorder_range(f2), "grandmother").base()); ! f2.reverse(adobe::child_begin(f2_grandmother), adobe::child_end(f2_grandmother)); ! ! output(adobe::depth_range(f2)); ! ! std::cout << "<- reverse iterator ->" << std::endl; ! ! output(adobe::depth_range(adobe::reverse_fullorder_range(f))); ! return 0; } |