]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/utility/shared_iterator_example2.cpp
1 // Copyright 2003 The Trustees of Indiana University.
3 // Use, modification and distribution is subject to the Boost Software
4 // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
5 // http://www.boost.org/LICENSE_1_0.txt)
7 #include "boost/shared_container_iterator.hpp"
8 #include "boost/shared_ptr.hpp"
15 template <typename Iterator
>
16 void print_range_nl (Iterator begin
, Iterator end
) {
17 typedef typename
std::iterator_traits
<Iterator
>::value_type val
;
18 std::copy(begin
,end
,std::ostream_iterator
<val
>(std::cout
,","));
25 typedef boost::shared_ptr
< std::vector
<int> > ints_t
;
27 ints_t
ints(new std::vector
<int>());
36 print_range_nl(boost::make_shared_container_iterator(ints
->begin(),ints
),
37 boost::make_shared_container_iterator(ints
->end(),ints
));