]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/iterator/example/node_iterator2.cpp
5ab71b67c470875c6e7160c75eb8281f12765066
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>
16 #if defined(BOOST_NO_CXX11_SMART_PTR)
18 std::auto_ptr
<node
<int> > nodes(new node
<int>(42));
22 std::unique_ptr
<node
<int> > nodes(new node
<int>(42));
26 nodes
->append(new node
<std::string
>(" is greater than "));
27 nodes
->append(new node
<int>(13));
29 // Check interoperability
30 assert(node_iterator(nodes
.get()) == node_const_iterator(nodes
.get()));
31 assert(node_const_iterator(nodes
.get()) == node_iterator(nodes
.get()));
33 assert(node_iterator(nodes
.get()) != node_const_iterator());
34 assert(node_const_iterator(nodes
.get()) != node_iterator());
37 node_iterator(nodes
.get()), node_iterator()
38 , std::ostream_iterator
<node_base
>(std::cout
, " ")
40 std::cout
<< std::endl
;
43 node_iterator(nodes
.get()), node_iterator()
44 , boost::mem_fn(&node_base::double_me
)
48 node_const_iterator(nodes
.get()), node_const_iterator()
49 , std::ostream_iterator
<node_base
>(std::cout
, "/")
51 std::cout
<< std::endl
;