blob: 5615d45470e08e0e2e9549cd8ebaa4d305537e2b [file] [log] [blame]
Brian Silverman59623332018-08-04 23:36:56 -07001// Copyright 2003 The Trustees of Indiana University.
2
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)
6
7#include "boost/shared_container_iterator.hpp"
8#include "boost/shared_ptr.hpp"
9#include "boost/tuple/tuple.hpp" // for boost::tie
10#include <algorithm> // for std::copy
11#include <iostream>
12#include <vector>
13
14
15typedef boost::shared_container_iterator< std::vector<int> > iterator;
16
17std::pair<iterator,iterator>
18return_range() {
19 boost::shared_ptr< std::vector<int> > range(new std::vector<int>());
20 range->push_back(0);
21 range->push_back(1);
22 range->push_back(2);
23 range->push_back(3);
24 range->push_back(4);
25 range->push_back(5);
26 return boost::make_shared_container_range(range);
27}
28
29
30int main() {
31
32
33 iterator i,end;
34
35 boost::tie(i,end) = return_range();
36
37 std::copy(i,end,std::ostream_iterator<int>(std::cout,","));
38 std::cout.put('\n');
39
40 return 0;
41}