]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/iterator/example/node_iterator2.cpp
1 // Copyright David Abrahams 2004. Use, modification and distribution is
2 // subject to the Boost Software License, Version 1.0. (See accompanying
3 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5 #include "node_iterator2.hpp"
10 #include <boost/mem_fn.hpp>
15 std::auto_ptr
<node
<int> > nodes(new node
<int>(42));
16 nodes
->append(new node
<std::string
>(" is greater than "));
17 nodes
->append(new node
<int>(13));
19 // Check interoperability
20 assert(node_iterator(nodes
.get()) == node_const_iterator(nodes
.get()));
21 assert(node_const_iterator(nodes
.get()) == node_iterator(nodes
.get()));
23 assert(node_iterator(nodes
.get()) != node_const_iterator());
24 assert(node_const_iterator(nodes
.get()) != node_iterator());
27 node_iterator(nodes
.get()), node_iterator()
28 , std::ostream_iterator
<node_base
>(std::cout
, " ")
30 std::cout
<< std::endl
;
33 node_iterator(nodes
.get()), node_iterator()
34 , boost::mem_fn(&node_base::double_me
)
38 node_const_iterator(nodes
.get()), node_const_iterator()
39 , std::ostream_iterator
<node_base
>(std::cout
, "/")
41 std::cout
<< std::endl
;