// Copyright David Abrahams 2004. Use, modification and distribution is // 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) #include "node_iterator1.hpp" #include #include #include #include #include int main() { #if defined(BOOST_NO_CXX11_SMART_PTR) std::auto_ptr > nodes(new node(42)); #else std::unique_ptr > nodes(new node(42)); #endif nodes->append(new node(" is greater than ")); nodes->append(new node(13)); std::copy( node_iterator(nodes.get()), node_iterator() , std::ostream_iterator(std::cout, " ") ); std::cout << std::endl; std::for_each( node_iterator(nodes.get()), node_iterator() , std::mem_fun_ref(&node_base::double_me) ); std::copy( node_iterator(nodes.get()), node_iterator() , std::ostream_iterator(std::cout, "/") ); std::cout << std::endl; }