Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r48819 - sandbox/SOC/2006/tree/trunk/libs/tree/example
From: ockham_at_[hidden]
Date: 2008-09-17 13:19:48


Author: bernhard.reiter
Date: 2008-09-17 13:19:48 EDT (Wed, 17 Sep 2008)
New Revision: 48819
URL: http://svn.boost.org/trac/boost/changeset/48819

Log:
Add example files I previously forgot.
Added:
   sandbox/SOC/2006/tree/trunk/libs/tree/example/Jamfile.v2 (contents, props changed)
   sandbox/SOC/2006/tree/trunk/libs/tree/example/for_each.cpp (contents, props changed)

Added: sandbox/SOC/2006/tree/trunk/libs/tree/example/Jamfile.v2
==============================================================================
--- (empty file)
+++ sandbox/SOC/2006/tree/trunk/libs/tree/example/Jamfile.v2 2008-09-17 13:19:48 EDT (Wed, 17 Sep 2008)
@@ -0,0 +1,53 @@
+# Copyright (c) 2006-2008, Bernhard Reiter
+#
+# Distributed under the Boost Software License, Version 1.0.
+# (See accompanying file LICENSE_1_0.txt or copy at
+# http:#www.boost.org/LICENSE_1_0.txt)
+
+# Adapted from Ion Gaztañaga's Boost Intrusive Library Example Jamfile
+
+# (C) Copyright Ion Gaztañaga 2006-2007.
+# Use, modification and distribution are subject to the
+# Boost Software License, Version 1.0. (See accompanying file
+# LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+# Adapted from John Maddock's TR1 Jamfile.v2
+# Copyright John Maddock 2005.
+# Use, modification and distribution are subject to the
+# Boost Software License, Version 1.0. (See accompanying file
+# LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+# this rule enumerates through all the sources and invokes
+# the run rule for each source, the result is a list of all
+# the run rules, which we can pass on to the test_suite rule:
+
+using testing ;
+
+if ! $(BOOST_ROOT)
+{
+ BOOST_ROOT = [ modules.peek : BOOST_ROOT ] ;
+}
+
+project :
+ : requirements
+ <include>$(BOOST_ROOT)
+ <include>../../../
+ ;
+
+rule test_all
+{
+ local all_rules = ;
+
+ for local fileb in [ glob *.cpp ]
+ {
+ all_rules += [ run $(fileb)
+ : # additional args
+ : # test-files
+ : # requirements
+ ] ;
+ }
+
+ return $(all_rules) ;
+}
+
+test-suite test_example : [ test_all r ] ;
\ No newline at end of file

Added: sandbox/SOC/2006/tree/trunk/libs/tree/example/for_each.cpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2006/tree/trunk/libs/tree/example/for_each.cpp 2008-09-17 13:19:48 EDT (Wed, 17 Sep 2008)
@@ -0,0 +1,41 @@
+// Copyright (c) 2006-2008, Bernhard Reiter
+//
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/tree/binary_tree.hpp>
+//[ foreach_include_algorithm
+#include <boost/tree/algorithm.hpp>
+//]
+
+#include <iostream>
+
+#include "../test/test_tree_traversal_data.hpp"
+
+using namespace boost::tree;
+
+//[ for_each
+void to_cout(int i) {
+ std::cout << ' ' << i;
+ return;
+}
+
+int main() {
+ binary_tree<int> bt;
+
+ // Fill it with data...
+ create_test_data_tree(bt);
+
+ std::cout << "Preorder:";
+ preorder::for_each(bt.root(), to_cout);
+
+ std::cout << std::endl << "Inorder:";
+ inorder::for_each(bt.root(), to_cout);
+
+ std::cout << std::endl << "Postorder:";
+ postorder::for_each(bt.root(), to_cout);
+
+ return 0;
+}
+//]
\ No newline at end of file


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