Imported Upstream version 1.51.0
[platform/upstream/boost.git] / libs / range / doc / reference / adaptors / examples / copied.cpp
1 // Boost.Range library
2 //
3 //  Copyright Thorsten Ottosen 2003-2004. Use, modification and
4 //  distribution is subject to the Boost Software License, Version
5 //  1.0. (See accompanying file LICENSE_1_0.txt or copy at
6 //  http://www.boost.org/LICENSE_1_0.txt)
7 //
8 // For more information, see http://www.boost.org/libs/range/
9 //
10 #include <boost/range/adaptor/copied.hpp>
11 #include <boost/range/algorithm/copy.hpp>
12 #include <boost/assign.hpp>
13 #include <algorithm>
14 #include <iostream>
15 #include <vector>
16
17 int main(int argc, const char* argv[])
18 {
19     using namespace boost::assign;
20     using namespace boost::adaptors;
21     
22     std::vector<int> input;
23     input += 1,2,3,4,5,6,7,8,9,10;
24     
25     boost::copy(
26         input | copied(1, 5),
27         std::ostream_iterator<int>(std::cout, ","));
28         
29     return 0;
30 }
31