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_INDIRECTED_HPP
0012 #define BOOST_RANGE_ADAPTOR_INDIRECTED_HPP
0013
0014 #include <boost/range/iterator_range.hpp>
0015 #include <boost/range/concepts.hpp>
0016 #include <boost/iterator/indirect_iterator.hpp>
0017
0018 namespace boost
0019 {
0020 namespace range_detail
0021 {
0022 template< class R >
0023 struct indirected_range :
0024 public boost::iterator_range<
0025 boost::indirect_iterator<
0026 BOOST_DEDUCED_TYPENAME range_iterator<R>::type
0027 >
0028 >
0029 {
0030 private:
0031 typedef boost::iterator_range<
0032 boost::indirect_iterator<
0033 BOOST_DEDUCED_TYPENAME range_iterator<R>::type
0034 >
0035 >
0036 base;
0037
0038 public:
0039 explicit indirected_range( R& r )
0040 : base( r )
0041 { }
0042 };
0043
0044 struct indirect_forwarder {};
0045
0046 template< class SinglePassRange >
0047 inline indirected_range<SinglePassRange>
0048 operator|( SinglePassRange& r, indirect_forwarder )
0049 {
0050 BOOST_RANGE_CONCEPT_ASSERT((
0051 SinglePassRangeConcept<SinglePassRange>));
0052
0053 return indirected_range<SinglePassRange>( r );
0054 }
0055
0056 template< class SinglePassRange >
0057 inline indirected_range<const SinglePassRange>
0058 operator|( const SinglePassRange& r, indirect_forwarder )
0059 {
0060 BOOST_RANGE_CONCEPT_ASSERT((
0061 SinglePassRangeConcept<const SinglePassRange>));
0062
0063 return indirected_range<const SinglePassRange>( r );
0064 }
0065
0066 }
0067
0068 using range_detail::indirected_range;
0069
0070 namespace adaptors
0071 {
0072 namespace
0073 {
0074 const range_detail::indirect_forwarder indirected =
0075 range_detail::indirect_forwarder();
0076 }
0077
0078 template<class SinglePassRange>
0079 inline indirected_range<SinglePassRange>
0080 indirect(SinglePassRange& rng)
0081 {
0082 BOOST_RANGE_CONCEPT_ASSERT((
0083 SinglePassRangeConcept<SinglePassRange>));
0084 return indirected_range<SinglePassRange>(rng);
0085 }
0086
0087 template<class SinglePassRange>
0088 inline indirected_range<const SinglePassRange>
0089 indirect(const SinglePassRange& rng)
0090 {
0091 BOOST_RANGE_CONCEPT_ASSERT((
0092 SinglePassRangeConcept<const SinglePassRange>));
0093
0094 return indirected_range<const SinglePassRange>(rng);
0095 }
0096 }
0097
0098 }
0099
0100 #endif