Brian Silverman | 598d029 | 2018-08-04 23:56:47 -0700 | [diff] [blame^] | 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/indirected.hpp> |
| 11 | #include <boost/range/algorithm/copy.hpp> |
| 12 | #include <boost/shared_ptr.hpp> |
| 13 | #include <algorithm> |
| 14 | #include <iostream> |
| 15 | #include <vector> |
| 16 | |
| 17 | int main(int argc, const char* argv[]) |
| 18 | { |
| 19 | using namespace boost::adaptors; |
| 20 | |
| 21 | std::vector<boost::shared_ptr<int> > input; |
| 22 | |
| 23 | for (int i = 0; i < 10; ++i) |
| 24 | input.push_back(boost::shared_ptr<int>(new int(i))); |
| 25 | |
| 26 | boost::copy( |
| 27 | input | indirected, |
| 28 | std::ostream_iterator<int>(std::cout, ",")); |
| 29 | |
| 30 | return 0; |
| 31 | } |
| 32 | |