Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r49667 - in sandbox/SOC/2006/tree/trunk: boost/tree boost/tree/detail/algorithm libs/tree/doc libs/tree/example
From: ockham_at_[hidden]
Date: 2008-11-09 14:42:46


Author: bernhard.reiter
Date: 2008-11-09 14:42:45 EST (Sun, 09 Nov 2008)
New Revision: 49667
URL: http://svn.boost.org/trac/boost/changeset/49667

Log:
Some doc fixes.
Text files modified:
   sandbox/SOC/2006/tree/trunk/boost/tree/algorithm.hpp | 4 ++
   sandbox/SOC/2006/tree/trunk/boost/tree/detail/algorithm/general.hpp | 14 ++++++--
   sandbox/SOC/2006/tree/trunk/boost/tree/detail/algorithm/inorder.hpp | 10 +++++-
   sandbox/SOC/2006/tree/trunk/boost/tree/detail/algorithm/postorder.hpp | 2 -
   sandbox/SOC/2006/tree/trunk/boost/tree/detail/algorithm/preorder.hpp | 2 -
   sandbox/SOC/2006/tree/trunk/libs/tree/doc/algorithms.qbk | 60 +++++++++++++++++++++++++++++++--------
   sandbox/SOC/2006/tree/trunk/libs/tree/example/for_each.cpp | 12 ++++----
   7 files changed, 75 insertions(+), 29 deletions(-)

Modified: sandbox/SOC/2006/tree/trunk/boost/tree/algorithm.hpp
==============================================================================
--- sandbox/SOC/2006/tree/trunk/boost/tree/algorithm.hpp (original)
+++ sandbox/SOC/2006/tree/trunk/boost/tree/algorithm.hpp 2008-11-09 14:42:45 EST (Sun, 09 Nov 2008)
@@ -122,8 +122,10 @@
  *
  * op must not change its argument.
  */
+//[ transform
 template <class Order, class InCursor, class OutCursor, class Op>
 OutCursor transform (Order, InCursor s, OutCursor t, Op op)
+//]
 {
     return transform(Order(), s, t, op
                   , typename cursor_vertical_traversal<InCursor>::type());
@@ -150,8 +152,10 @@
  * @param t An output cursor.
  * @result A cursor past t's *order end, after the copying operation.
  */
+//[ copy
 template <class Order, class InCursor, class OutCursor>
 OutCursor copy (Order, InCursor s, OutCursor t)
+//]
 {
     return copy(Order(), s, t
               , typename cursor_vertical_traversal<InCursor>::type());

Modified: sandbox/SOC/2006/tree/trunk/boost/tree/detail/algorithm/general.hpp
==============================================================================
--- sandbox/SOC/2006/tree/trunk/boost/tree/detail/algorithm/general.hpp (original)
+++ sandbox/SOC/2006/tree/trunk/boost/tree/detail/algorithm/general.hpp 2008-11-09 14:42:45 EST (Sun, 09 Nov 2008)
@@ -25,17 +25,19 @@
 
 // What about the subtree shapes?
 /**
- * @brief Checks two subtrees for element-wise equality.
- * @param c1 An input cursor.
- * @param c2 An input cursor.
- * @return A boolean true or false.
+ * @brief Checks two subtrees for element-wise equality.
+ * @param c1 An input cursor.
+ * @param c2 An input cursor.
+ * @return A boolean true or false.
  *
  * Compares the elements of two subtrees using @c ==. Returns true if
  * all the corresponding elements of the subtrees are equal; otherwise,
  * it returns false.
  */
+//[ equal
 template <class InCursor1, class InCursor2>
 bool equal(InCursor1 c1, InCursor2 c2)
+//]
 {
     InCursor1 d1 = c1.end();
     c1.to_begin();
@@ -63,8 +65,10 @@
  * Returns true if all the corresponding elements of the
  * subtrees are equal; otherwise, it returns false.
  */
+//[ equal_pred
 template <class InCursor1, class InCursor2, class BinPred>
 bool equal(InCursor1 c1, InCursor2 c2, BinPred p)
+//]
 {
     InCursor1 d1 = c1.end();
     c1.to_begin();
@@ -105,8 +109,10 @@
  * @param c An input cursor.
  * @return The size type of @c c1.
  */
+//[ size
 template <class InCursor>
 typename InCursor::size_type size(InCursor c)
+//]
 {
     typename InCursor::size_type s = 0;
     InCursor d = c.end();

Modified: sandbox/SOC/2006/tree/trunk/boost/tree/detail/algorithm/inorder.hpp
==============================================================================
--- sandbox/SOC/2006/tree/trunk/boost/tree/detail/algorithm/inorder.hpp (original)
+++ sandbox/SOC/2006/tree/trunk/boost/tree/detail/algorithm/inorder.hpp 2008-11-09 14:42:45 EST (Sun, 09 Nov 2008)
@@ -124,10 +124,8 @@
  * inorder. @p f must not modify the order of the sequence.
  * If @p f has a return value it is ignored.
  */
- //[ inorder_for_each
 template <class MultiwayCursor, class Op>
 Op for_each(inorder, MultiwayCursor s, Op f, forward_traversal_tag)
-//]
 {
     MultiwayCursor t = s.end();
 
@@ -190,8 +188,10 @@
  * @a val, or @x if every element in the subtree is less than
  * @a val.
  */
+//[ lower_bound
 template <class MultiwayCursor, class T>
 MultiwayCursor lower_bound(MultiwayCursor x, T const& val)
+//]
 {
     MultiwayCursor y = x;
     while (!x.empty()) {
@@ -213,8 +213,10 @@
  * @a val, or @x if every element in the subtree is less than
  * @a val.
  */
+//[ lower_bound_cmp
 template <class MultiwayCursor, class T, class Cmp>
 MultiwayCursor lower_bound(MultiwayCursor x, T const& val, Cmp cmp)
+//]
 {
     MultiwayCursor y = x;
     while (!x.empty()) {
@@ -235,8 +237,10 @@
  * @a val, or @x if no element in the subtree is greater than
  * @a val.
  */
+//[ upper_bound
 template <class MultiwayCursor, class T>
 MultiwayCursor upper_bound(MultiwayCursor x, T const& val)
+//]
 {
     MultiwayCursor y = x;
     while (!x.empty()) {
@@ -258,8 +262,10 @@
  * @a val, or @x if no element in the subtree is greater than
  * @a val.
  */
+//[ upper_bound_cmp
 template <class MultiwayCursor, class T, class Cmp>
 MultiwayCursor upper_bound(MultiwayCursor x, T const& val, Cmp cmp)
+//]
 {
     MultiwayCursor y = x;
     while (!x.empty()) {

Modified: sandbox/SOC/2006/tree/trunk/boost/tree/detail/algorithm/postorder.hpp
==============================================================================
--- sandbox/SOC/2006/tree/trunk/boost/tree/detail/algorithm/postorder.hpp (original)
+++ sandbox/SOC/2006/tree/trunk/boost/tree/detail/algorithm/postorder.hpp 2008-11-09 14:42:45 EST (Sun, 09 Nov 2008)
@@ -152,10 +152,8 @@
  * postorder. @p f must not modify the order of the sequence.
  * If @p f has a return value it is ignored.
  */
-//[ postorder_for_each
 template <class Cursor, class Op>
 Op for_each(postorder, Cursor s, Op f, forward_traversal_tag)
-//]
 {
     Cursor t = s;
     for (s.to_begin(); s != t.end(); ++s)

Modified: sandbox/SOC/2006/tree/trunk/boost/tree/detail/algorithm/preorder.hpp
==============================================================================
--- sandbox/SOC/2006/tree/trunk/boost/tree/detail/algorithm/preorder.hpp (original)
+++ sandbox/SOC/2006/tree/trunk/boost/tree/detail/algorithm/preorder.hpp 2008-11-09 14:42:45 EST (Sun, 09 Nov 2008)
@@ -149,10 +149,8 @@
  * preorder. @p f must not modify the order of the sequence.
  * If @p f has a return value it is ignored.
  */
-//[ preorder_for_each
 template <class Cursor, class Op>
 Op for_each(preorder, Cursor s, Op f, forward_traversal_tag)
-//]
 {
     Cursor t = s.end();
     for (s.to_begin(); s != t; ++s) {

Modified: sandbox/SOC/2006/tree/trunk/libs/tree/doc/algorithms.qbk
==============================================================================
--- sandbox/SOC/2006/tree/trunk/libs/tree/doc/algorithms.qbk (original)
+++ sandbox/SOC/2006/tree/trunk/libs/tree/doc/algorithms.qbk 2008-11-09 14:42:45 EST (Sun, 09 Nov 2008)
@@ -11,9 +11,9 @@
  / Algorithms documentation file.
  /]
 
-[import ../../../boost/tree/detail/algorithm/cursor/preorder.hpp]
-[import ../../../boost/tree/detail/algorithm/cursor/inorder.hpp]
-[import ../../../boost/tree/detail/algorithm/cursor/postorder.hpp]
+[import ../../../boost/tree/algorithm.hpp]
+[import ../../../boost/tree/detail/algorithm/general.hpp]
+[import ../../../boost/tree/detail/algorithm/inorder.hpp]
 [import ../example/for_each.cpp]
 
 [section Algorithms]
@@ -31,9 +31,9 @@
 
 These three types of traversal are called /preorder/, /inorder/ and /postorder/, and
 consequently, an algorithm can come in each out of these three flavors
-(and many algorithms will come in all three). For clarity, all the algorithms
-of one such traversal type are bundled in a namespace of the corresponding
-name (ie, `preorder`, `inorder`, and `postorder`).
+(and many algorithms will come in all three). To indicate what version is desired,
+an instance of the corresponding type is passed as the first argument to the
+algorithm.
 
 Algorithms can be used via
 
@@ -41,21 +41,55 @@
 
 TODO: Include illustration of example data tree.
 
-[section Pre-, In-, and Postorder Algorithms]
+[section General Algorithms]
 
-[section for_each]
+[section equal]
+[equal]
+[equal_pred]
+[funcref boost::tree::equal Reference]
+[endsect] [/ equal]
+
+[section size]
+[size]
+[funcref boost::tree::size Reference]
+[endsect] [/ size]
 
-[preorder_for_each]
-[inorder_for_each]
-[postorder_for_each]
+[endsect] [/ General Algorithms]
 
-[funcref boost::tree:preorder::for_each]
+[section Pre-, In-, and Postorder Algorithms]
 
-[section Example]
+[section for_each]
 [for_each]
+[funcref boost::tree::for_each Reference]
+
+[section Example]
+[for_each_example]
 [endsect] [/Example]
 [endsect] [/for_each]
 
+[section copy]
+[copy]
+[funcref boost::tree::copy Reference]
+[endsect] [/copy]
+
+[section transform]
+[transform]
+[funcref boost::tree::transform Reference]
+[endsect] [/transform]
+
 [endsect] [/ Pre-, In-, and Postorder Algorithms]
 
+[section Inorder Binary Tree Search (BTS) Algorithms]
+[lower_bound]
+[lower_bound_cmp]
+
+[funcref boost::tree::lower_bound lower_bound reference]
+
+[upper_bound]
+[upper_bound_cmp]
+
+[funcref boost::tree::upper_bound upper_bound reference]
+
+[endsect] [/ Inorder Binary Search Algorithms]
+
 [endsect] [/ Algorithms]

Modified: sandbox/SOC/2006/tree/trunk/libs/tree/example/for_each.cpp
==============================================================================
--- sandbox/SOC/2006/tree/trunk/libs/tree/example/for_each.cpp (original)
+++ sandbox/SOC/2006/tree/trunk/libs/tree/example/for_each.cpp 2008-11-09 14:42:45 EST (Sun, 09 Nov 2008)
@@ -5,7 +5,7 @@
 // http://www.boost.org/LICENSE_1_0.txt)
 
 #include <boost/tree/binary_tree.hpp>
-//[ foreach_include_algorithm
+//[ for_each_include_algorithm
 #include <boost/tree/algorithm.hpp>
 //]
 
@@ -15,7 +15,7 @@
 
 using namespace boost::tree;
 
-//[ for_each
+//[ for_each_example
 void to_cout(int i) {
     std::cout << ' ' << i;
     return;
@@ -25,16 +25,16 @@
     binary_tree<int> bt;
     
     // Fill it with data...
- create_test_dataset1_tree(bt);
+ test_binary_tree_fixture<int>::create_test_dataset1_tree(bt);
 
     std::cout << "Preorder:";
- preorder::for_each(bt.root(), to_cout);
+ for_each(preorder(), bt.root(), to_cout);
     
     std::cout << std::endl << "Inorder:";
- inorder::for_each(bt.root(), to_cout);
+ for_each(inorder(), bt.root(), to_cout);
     
     std::cout << std::endl << "Postorder:";
- postorder::for_each(bt.root(), to_cout);
+ for_each(postorder(), bt.root(), to_cout);
 
     return 0;
 }


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk