3 // Copyright Thorsten Ottosen, Neil Groves 2006. 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)
8 // For more information, see http://www.boost.org/libs/range/
11 #ifndef BOOST_RANGE_ADAPTOR_COPIED_HPP
12 #define BOOST_RANGE_ADAPTOR_COPIED_HPP
14 #include <boost/range/adaptor/argument_fwd.hpp>
15 #include <boost/range/adaptor/sliced.hpp>
16 #include <boost/range/size_type.hpp>
17 #include <boost/range/iterator_range.hpp>
18 #include <boost/range/concepts.hpp>
26 copied(std::size_t t_, std::size_t u_)
33 template<class CopyableRandomAccessRange>
34 inline CopyableRandomAccessRange
35 operator|(const CopyableRandomAccessRange& r, const copied& f)
37 BOOST_RANGE_CONCEPT_ASSERT((
38 RandomAccessRangeConcept<const CopyableRandomAccessRange>));
41 BOOST_DEDUCED_TYPENAME range_iterator<
42 const CopyableRandomAccessRange
44 > temp(adaptors::slice(r, f.t, f.u));
46 return CopyableRandomAccessRange(temp.begin(), temp.end());
49 template<class CopyableRandomAccessRange>
50 inline CopyableRandomAccessRange
51 copy(const CopyableRandomAccessRange& rng, std::size_t t, std::size_t u)
53 BOOST_RANGE_CONCEPT_ASSERT((
54 RandomAccessRangeConcept<const CopyableRandomAccessRange>));
57 BOOST_DEDUCED_TYPENAME range_iterator<
58 const CopyableRandomAccessRange
60 > temp(adaptors::slice(rng, t, u));
62 return CopyableRandomAccessRange( temp.begin(), temp.end() );
68 #endif // include guard