]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/iterator/example/shared_iterator_example2.cpp
update source to Ceph Pacific 16.2.2
[ceph.git] / ceph / src / boost / libs / iterator / example / shared_iterator_example2.cpp
CommitLineData
7c673cae
FG
1// Copyright 2003 The Trustees of Indiana University.
2
f67539c2 3// Use, modification and distribution is subject to the Boost Software
7c673cae
FG
4// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
5// http://www.boost.org/LICENSE_1_0.txt)
6
7#include "boost/shared_container_iterator.hpp"
8#include "boost/shared_ptr.hpp"
9#include <algorithm>
10#include <iterator>
11#include <iostream>
12#include <vector>
13
14
15template <typename Iterator>
16void 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,","));
19 std::cout.put('\n');
20}
21
22
23int main() {
24
25 typedef boost::shared_ptr< std::vector<int> > ints_t;
26 {
27 ints_t ints(new std::vector<int>());
28
29 ints->push_back(0);
30 ints->push_back(1);
31 ints->push_back(2);
32 ints->push_back(3);
33 ints->push_back(4);
34 ints->push_back(5);
35
36 print_range_nl(boost::make_shared_container_iterator(ints->begin(),ints),
37 boost::make_shared_container_iterator(ints->end(),ints));
38 }
f67539c2 39
7c673cae
FG
40
41
42 return 0;
43}