File indexing completed on 2025-01-18 09:51:13
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #ifndef BOOST_RANGE_ADAPTOR_COPIED_HPP
0012 #define BOOST_RANGE_ADAPTOR_COPIED_HPP
0013
0014 #include <boost/range/adaptor/argument_fwd.hpp>
0015 #include <boost/range/adaptor/sliced.hpp>
0016 #include <boost/range/size_type.hpp>
0017 #include <boost/range/iterator_range.hpp>
0018 #include <boost/range/concepts.hpp>
0019
0020 namespace boost
0021 {
0022 namespace adaptors
0023 {
0024 struct copied
0025 {
0026 copied(std::size_t t_, std::size_t u_)
0027 : t(t_), u(u_) {}
0028
0029 std::size_t t;
0030 std::size_t u;
0031 };
0032
0033 template<class CopyableRandomAccessRange>
0034 inline CopyableRandomAccessRange
0035 operator|(const CopyableRandomAccessRange& r, const copied& f)
0036 {
0037 BOOST_RANGE_CONCEPT_ASSERT((
0038 RandomAccessRangeConcept<const CopyableRandomAccessRange>));
0039
0040 iterator_range<
0041 BOOST_DEDUCED_TYPENAME range_iterator<
0042 const CopyableRandomAccessRange
0043 >::type
0044 > temp(adaptors::slice(r, f.t, f.u));
0045
0046 return CopyableRandomAccessRange(temp.begin(), temp.end());
0047 }
0048
0049 template<class CopyableRandomAccessRange>
0050 inline CopyableRandomAccessRange
0051 copy(const CopyableRandomAccessRange& rng, std::size_t t, std::size_t u)
0052 {
0053 BOOST_RANGE_CONCEPT_ASSERT((
0054 RandomAccessRangeConcept<const CopyableRandomAccessRange>));
0055
0056 iterator_range<
0057 BOOST_DEDUCED_TYPENAME range_iterator<
0058 const CopyableRandomAccessRange
0059 >::type
0060 > temp(adaptors::slice(rng, t, u));
0061
0062 return CopyableRandomAccessRange( temp.begin(), temp.end() );
0063 }
0064 }
0065
0066 }
0067
0068 #endif