applied bug fixes

[SVN r33038]
This commit is contained in:
Thorsten Jørgen Ottosen
2006-02-20 21:15:05 +00:00
parent e50a544c2a
commit b22773b2e3
7 changed files with 77 additions and 72 deletions

View File

@ -190,7 +190,7 @@ namespace boost
inline BOOST_DEDUCED_TYPENAME range_const_iterator<T>::type inline BOOST_DEDUCED_TYPENAME range_const_iterator<T>::type
const_begin( const T& r ) const_begin( const T& r )
{ {
return begin( r ); return boost::begin( r );
} }
} }

View File

@ -78,35 +78,35 @@ namespace boost
template< typename C > template< typename C >
class range class range
{ {
typedef BOOST_RANGE_DEDUCED_TYPENAME boost::mpl::if_c< boost::range_detail::range_helper<C>::is_pair_, typedef BOOST_RANGE_DEDUCED_TYPENAME boost::mpl::if_c< ::boost::range_detail::range_helper<C>::is_pair_,
boost::range_detail::std_pair_, boost::range_detail::std_pair_,
void >::type pair_t; void >::type pair_t;
typedef BOOST_RANGE_DEDUCED_TYPENAME boost::mpl::if_c< boost::range_detail::range_helper<C>::is_array_, typedef BOOST_RANGE_DEDUCED_TYPENAME boost::mpl::if_c< ::boost::range_detail::range_helper<C>::is_array_,
boost::range_detail::array_, boost::range_detail::array_,
pair_t >::type array_t; pair_t >::type array_t;
typedef BOOST_RANGE_DEDUCED_TYPENAME boost::mpl::if_c< boost::range_detail::range_helper<C>::is_string_, typedef BOOST_RANGE_DEDUCED_TYPENAME boost::mpl::if_c< ::boost::range_detail::range_helper<C>::is_string_,
boost::range_detail::string_, boost::range_detail::string_,
array_t >::type string_t; array_t >::type string_t;
typedef BOOST_RANGE_DEDUCED_TYPENAME boost::mpl::if_c< boost::range_detail::range_helper<C>::is_const_char_ptr_, typedef BOOST_RANGE_DEDUCED_TYPENAME boost::mpl::if_c< ::boost::range_detail::range_helper<C>::is_const_char_ptr_,
boost::range_detail::const_char_ptr_, boost::range_detail::const_char_ptr_,
string_t >::type const_char_ptr_t; string_t >::type const_char_ptr_t;
typedef BOOST_RANGE_DEDUCED_TYPENAME boost::mpl::if_c< boost::range_detail::range_helper<C>::is_char_ptr_, typedef BOOST_RANGE_DEDUCED_TYPENAME boost::mpl::if_c< ::boost::range_detail::range_helper<C>::is_char_ptr_,
boost::range_detail::char_ptr_, boost::range_detail::char_ptr_,
const_char_ptr_t >::type char_ptr_t; const_char_ptr_t >::type char_ptr_t;
typedef BOOST_RANGE_DEDUCED_TYPENAME boost::mpl::if_c< boost::range_detail::range_helper<C>::is_const_wchar_t_ptr_, typedef BOOST_RANGE_DEDUCED_TYPENAME boost::mpl::if_c< ::boost::range_detail::range_helper<C>::is_const_wchar_t_ptr_,
boost::range_detail::const_wchar_t_ptr_, boost::range_detail::const_wchar_t_ptr_,
char_ptr_t >::type const_wchar_ptr_t; char_ptr_t >::type const_wchar_ptr_t;
typedef BOOST_RANGE_DEDUCED_TYPENAME boost::mpl::if_c< boost::range_detail::range_helper<C>::is_wchar_t_ptr_, typedef BOOST_RANGE_DEDUCED_TYPENAME boost::mpl::if_c< ::boost::range_detail::range_helper<C>::is_wchar_t_ptr_,
boost::range_detail::wchar_t_ptr_, boost::range_detail::wchar_t_ptr_,
const_wchar_ptr_t >::type wchar_ptr_t; const_wchar_ptr_t >::type wchar_ptr_t;
typedef BOOST_RANGE_DEDUCED_TYPENAME boost::mpl::if_c< boost::range_detail::range_helper<C>::is_wchar_t_array_, typedef BOOST_RANGE_DEDUCED_TYPENAME boost::mpl::if_c< ::boost::range_detail::range_helper<C>::is_wchar_t_array_,
boost::range_detail::wchar_t_array_, boost::range_detail::wchar_t_array_,
wchar_ptr_t >::type wchar_array_t; wchar_ptr_t >::type wchar_array_t;
typedef BOOST_RANGE_DEDUCED_TYPENAME boost::mpl::if_c< boost::range_detail::range_helper<C>::is_char_array_, typedef BOOST_RANGE_DEDUCED_TYPENAME boost::mpl::if_c< ::boost::range_detail::range_helper<C>::is_char_array_,
boost::range_detail::char_array_, boost::range_detail::char_array_,
wchar_array_t >::type char_array_t; wchar_array_t >::type char_array_t;
public: public:
typedef BOOST_RANGE_DEDUCED_TYPENAME boost::mpl::if_c< boost::is_void<char_array_t>::value, typedef BOOST_RANGE_DEDUCED_TYPENAME boost::mpl::if_c< ::boost::is_void<char_array_t>::value,
boost::range_detail::std_container_, boost::range_detail::std_container_,
char_array_t >::type type; char_array_t >::type type;
}; // class 'range' }; // class 'range'

View File

@ -194,7 +194,7 @@ namespace boost
inline BOOST_DEDUCED_TYPENAME range_const_iterator<T>::type inline BOOST_DEDUCED_TYPENAME range_const_iterator<T>::type
const_end( const T& r ) const_end( const T& r )
{ {
return end( r ); return boost::end( r );
} }
} }

View File

@ -57,15 +57,13 @@ namespace boost
template< class ForwardRange > template< class ForwardRange >
static IteratorT adl_begin( ForwardRange& r ) static IteratorT adl_begin( ForwardRange& r )
{ {
using boost::begin; return IteratorT( boost::begin( r ) );
return IteratorT( begin( r ) );
} }
template< class ForwardRange > template< class ForwardRange >
static IteratorT adl_end( ForwardRange& r ) static IteratorT adl_end( ForwardRange& r )
{ {
using boost::end; return IteratorT( boost::end( r ) );
return IteratorT( end( r ) );
} }
}; };
@ -74,23 +72,23 @@ namespace boost
{ {
typedef BOOST_DEDUCED_TYPENAME boost::range_size<Left>::type sz_type; typedef BOOST_DEDUCED_TYPENAME boost::range_size<Left>::type sz_type;
sz_type l_size = size( l ), sz_type l_size = boost::size( l ),
r_size = size( r ); r_size = boost::size( r );
if( l_size != r_size ) if( l_size != r_size )
return false; return false;
return std::equal( begin(l), end(l), return std::equal( boost::begin(l), boost::end(l),
begin(r) ); boost::begin(r) );
} }
template< class Left, class Right > template< class Left, class Right >
inline bool less_than( const Left& l, const Right& r ) inline bool less_than( const Left& l, const Right& r )
{ {
return std::lexicographical_compare( begin(l), return std::lexicographical_compare( boost::begin(l),
end(l), boost::end(l),
begin(r), boost::begin(r),
end(r) ); boost::end(r) );
} }
struct range_tag { }; struct range_tag { };
@ -334,14 +332,16 @@ namespace boost
return m_Begin[sz]; return m_Begin[sz];
} }
void advance_begin( difference_type n ) iterator_range& advance_begin( difference_type n )
{ {
std::advance( m_Begin, n ); std::advance( m_Begin, n );
return *this;
} }
void advance_end( difference_type n ) iterator_range& advance_end( difference_type n )
{ {
std::advance( m_End, n ); std::advance( m_End, n );
return *this;
} }
private: private:
@ -378,7 +378,10 @@ namespace boost
std::basic_ostream<Elem, Traits>& Os, std::basic_ostream<Elem, Traits>& Os,
const iterator_range<IteratorT>& r ) const iterator_range<IteratorT>& r )
{ {
std::copy( r.begin(), r.end(), std::ostream_iterator<Elem>(Os)); std::copy( r.begin(), r.end(),
std::ostream_iterator< BOOST_DEDUCED_TYPENAME
iterator_value<IteratorT>::type,
Elem, Traits>(Os) );
return Os; return Os;
} }
@ -497,7 +500,7 @@ namespace boost
make_iterator_range( Range& r ) make_iterator_range( Range& r )
{ {
return iterator_range< BOOST_DEDUCED_TYPENAME range_result_iterator<Range>::type > return iterator_range< BOOST_DEDUCED_TYPENAME range_result_iterator<Range>::type >
( begin( r ), end( r ) ); ( boost::begin( r ), boost::end( r ) );
} }
#else #else
@ -536,8 +539,8 @@ namespace boost
return make_iterator_range( r ); return make_iterator_range( r );
BOOST_DEDUCED_TYPENAME range_result_iterator<Range>::type BOOST_DEDUCED_TYPENAME range_result_iterator<Range>::type
new_begin = begin( r ), new_begin = boost::begin( r ),
new_end = end( r ); new_end = boost::end( r );
std::advance( new_begin, advance_begin ); std::advance( new_begin, advance_begin );
std::advance( new_end, advance_end ); std::advance( new_end, advance_end );
return make_iterator_range( new_begin, new_end ); return make_iterator_range( new_begin, new_end );
@ -591,7 +594,7 @@ namespace boost
template< typename SeqT, typename Range > template< typename SeqT, typename Range >
inline SeqT copy_range( const Range& r ) inline SeqT copy_range( const Range& r )
{ {
return SeqT( begin( r ), end( r ) ); return SeqT( boost::begin( r ), boost::end( r ) );
} }
} // namespace 'boost' } // namespace 'boost'

View File

@ -42,7 +42,7 @@ rbegin( C& c )
typedef BOOST_DEDUCED_TYPENAME range_reverse_iterator< typedef BOOST_DEDUCED_TYPENAME range_reverse_iterator<
typename remove_const<C>::type >::type typename remove_const<C>::type >::type
iter_type; iter_type;
return iter_type( end( c ) ); return iter_type( boost::end( c ) );
} }
template< class C > template< class C >
@ -51,7 +51,7 @@ rbegin( const C& c )
{ {
typedef BOOST_DEDUCED_TYPENAME range_const_reverse_iterator<C>::type typedef BOOST_DEDUCED_TYPENAME range_const_reverse_iterator<C>::type
iter_type; iter_type;
return iter_type( end( c ) ); return iter_type( boost::end( c ) );
} }
#endif // BOOST_NO_FUNCTION_TEMPLATE_ORDERING #endif // BOOST_NO_FUNCTION_TEMPLATE_ORDERING
@ -60,7 +60,7 @@ template< class T >
inline BOOST_DEDUCED_TYPENAME range_const_reverse_iterator<T>::type inline BOOST_DEDUCED_TYPENAME range_const_reverse_iterator<T>::type
const_rbegin( const T& r ) const_rbegin( const T& r )
{ {
return rbegin( r ); return boost::rbegin( r );
} }
} // namespace 'boost' } // namespace 'boost'

View File

@ -29,7 +29,7 @@ template< class C >
inline BOOST_DEDUCED_TYPENAME range_reverse_result_iterator<C>::type inline BOOST_DEDUCED_TYPENAME range_reverse_result_iterator<C>::type
rend( C& c ) rend( C& c )
{ {
return BOOST_DEDUCED_TYPENAME range_reverse_result_iterator<C>::type( begin( c ) ); return BOOST_DEDUCED_TYPENAME range_reverse_result_iterator<C>::type( boost::begin( c ) );
} }
#else #else
@ -42,7 +42,7 @@ rend( C& c )
typedef BOOST_DEDUCED_TYPENAME range_reverse_iterator< typedef BOOST_DEDUCED_TYPENAME range_reverse_iterator<
typename remove_const<C>::type >::type typename remove_const<C>::type >::type
iter_type; iter_type;
return iter_type( begin( c ) ); return iter_type( boost::begin( c ) );
} }
template< class C > template< class C >
@ -51,7 +51,7 @@ rend( const C& c )
{ {
typedef BOOST_DEDUCED_TYPENAME range_const_reverse_iterator<C>::type typedef BOOST_DEDUCED_TYPENAME range_const_reverse_iterator<C>::type
iter_type; iter_type;
return iter_type( begin( c ) ); return iter_type( boost::begin( c ) );
} }
#endif #endif
@ -60,7 +60,7 @@ template< class T >
inline BOOST_DEDUCED_TYPENAME range_const_reverse_iterator<T>::type inline BOOST_DEDUCED_TYPENAME range_const_reverse_iterator<T>::type
const_rend( const T& r ) const_rend( const T& r )
{ {
return rend( r ); return boost::rend( r );
} }
} // namespace 'boost' } // namespace 'boost'

View File

@ -35,6 +35,8 @@ namespace boost
typedef BOOST_DEDUCED_TYPENAME range_const_iterator<ForwardRange>::type const_iterator; typedef BOOST_DEDUCED_TYPENAME range_const_iterator<ForwardRange>::type const_iterator;
typedef BOOST_DEDUCED_TYPENAME range_difference<ForwardRange>::type difference_type; typedef BOOST_DEDUCED_TYPENAME range_difference<ForwardRange>::type difference_type;
typedef BOOST_DEDUCED_TYPENAME range_size<ForwardRange>::type size_type; typedef BOOST_DEDUCED_TYPENAME range_size<ForwardRange>::type size_type;
typedef BOOST_DEDUCED_TYPENAME base::reference reference;
typedef BOOST_DEDUCED_TYPENAME iterator_reference<const_iterator>::type const_reference;
public: public:
sub_range() : base() sub_range() : base()
@ -109,32 +111,32 @@ namespace boost
public: // convenience public: // convenience
value_type& front() reference front()
{ {
return base::front(); return base::front();
} }
const value_type& front() const const_reference front() const
{ {
return base::front(); return base::front();
} }
value_type& back() reference back()
{ {
return base::back(); return base::back();
} }
const value_type& back() const const_reference back() const
{ {
return base::back(); return base::back();
} }
value_type& operator[]( size_type sz ) reference operator[]( size_type sz )
{ {
return base::operator[](sz); return base::operator[](sz);
} }
const value_type& operator[]( size_type sz ) const const_reference operator[]( size_type sz ) const
{ {
return base::operator[](sz); return base::operator[](sz);
} }