Attempt to represent the S^2->S^3 header reorganisation as a series of "hg rename" operations
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)
8 // For more information, see http://www.boost.org/libs/range/
11 #ifndef BOOST_RANGE_SUB_RANGE_HPP
12 #define BOOST_RANGE_SUB_RANGE_HPP
14 #include <boost/range/config.hpp>
15 #include <boost/range/iterator_range.hpp>
16 #include <boost/range/value_type.hpp>
17 #include <boost/range/result_iterator.hpp>
18 #include <boost/range/size_type.hpp>
19 #include <boost/range/difference_type.hpp>
20 #include <boost/assert.hpp>
25 template< class ForwardRange >
26 class sub_range : public iterator_range< BOOST_DEDUCED_TYPENAME range_result_iterator<ForwardRange>::type >
28 typedef BOOST_DEDUCED_TYPENAME range_result_iterator<ForwardRange>::type iterator_t;
29 typedef iterator_range< iterator_t > base;
31 typedef BOOST_DEDUCED_TYPENAME base::impl impl;
33 typedef BOOST_DEDUCED_TYPENAME range_value<ForwardRange>::type value_type;
34 typedef BOOST_DEDUCED_TYPENAME range_result_iterator<ForwardRange>::type iterator;
35 typedef BOOST_DEDUCED_TYPENAME range_const_iterator<ForwardRange>::type const_iterator;
36 typedef BOOST_DEDUCED_TYPENAME range_difference<ForwardRange>::type difference_type;
37 typedef BOOST_DEDUCED_TYPENAME range_size<ForwardRange>::type size_type;
38 typedef BOOST_DEDUCED_TYPENAME base::reference reference;
39 typedef BOOST_DEDUCED_TYPENAME iterator_reference<const_iterator>::type const_reference;
46 template< class ForwardRange2 >
47 sub_range( sub_range<ForwardRange2> r ) :
49 #if BOOST_WORKAROUND(BOOST_INTEL_CXX_VERSION, <= 800 )
50 base( impl::adl_begin( r ), impl::adl_end( r ) )
55 template< class ForwardRange2 >
56 sub_range( ForwardRange2& r ) :
58 #if BOOST_WORKAROUND(BOOST_INTEL_CXX_VERSION, <= 800 )
59 base( impl::adl_begin( r ), impl::adl_end( r ) )
65 template< class ForwardRange2 >
66 sub_range( const ForwardRange2& r ) :
68 #if BOOST_WORKAROUND(BOOST_INTEL_CXX_VERSION, <= 800 )
69 base( impl::adl_begin( r ), impl::adl_end( r ) )
75 template< class Iter >
76 sub_range( Iter first, Iter last ) :
80 template< class ForwardRange2 >
81 sub_range& operator=( ForwardRange2& r )
87 template< class ForwardRange2 >
88 sub_range& operator=( const ForwardRange2& r )
94 sub_range& operator=( sub_range r )
97 // argument passed by value to avoid
98 // const_iterator to iterator conversion
100 base::operator=( r );
106 iterator begin() { return base::begin(); }
107 const_iterator begin() const { return base::begin(); }
108 iterator end() { return base::end(); }
109 const_iterator end() const { return base::end(); }
110 size_type size() const { return base::size(); }
113 public: // convenience
116 return base::front();
119 const_reference front() const
121 return base::front();
129 const_reference back() const
134 reference operator[]( size_type sz )
136 return base::operator[](sz);
139 const_reference operator[]( size_type sz ) const
141 return base::operator[](sz);
146 template< class ForwardRange, class ForwardRange2 >
147 inline bool operator==( const sub_range<ForwardRange>& l,
148 const sub_range<ForwardRange2>& r )
150 return iterator_range_detail::equal( l, r );
153 template< class ForwardRange, class ForwardRange2 >
154 inline bool operator!=( const sub_range<ForwardRange>& l,
155 const sub_range<ForwardRange2>& r )
157 return !iterator_range_detail::equal( l, r );
160 template< class ForwardRange, class ForwardRange2 >
161 inline bool operator<( const sub_range<ForwardRange>& l,
162 const sub_range<ForwardRange2>& r )
164 return iterator_range_detail::less_than( l, r );
168 } // namespace 'boost'