*** empty log message ***

[SVN r25018]
This commit is contained in:
Thorsten Jørgen Ottosen
2004-09-11 15:33:46 +00:00
parent cfb03e4aee
commit 3abdd3afd4

View File

@ -29,6 +29,32 @@
namespace boost { namespace boost {
namespace range_detail
{
template< class Left, class Right >
inline bool equal( const Left& l, const Right& r )
{
typedef BOOST_DEDUCED_TYPENAME range_size<Left>::type sz_type;
sz_type l_size = boost::size( l ),
r_size = boost::size( r );
if( l_size != r_size )
return false;
return std::equal( boost::begin(l), boost::end(l),
boost::begin(r) );
}
template< class Left, class Right >
inline bool less_than( const Left& l, const Right& r )
{
return std::lexicographical_compare( boost::begin(l),
boost::end(l),
boost::begin(r),
boost::end(r) );
}
}
// iterator range template class -----------------------------------------// // iterator range template class -----------------------------------------//
//! iterator_range class //! iterator_range class
@ -187,6 +213,25 @@ namespace boost {
return singular == r.singular && m_Begin == r.m_Begin && m_End == r.m_End; return singular == r.singular && m_Begin == r.m_Begin && m_End == r.m_End;
} }
#ifdef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
bool operator==( const iterator_range& r ) const
{
return range_detail::equal( *this, r );
}
bool operator!=( const iterator_range& r ) const
{
return !operator==(r);
}
bool operator<( const iterator_range& r ) const
{
return range_detail::less_than( *this, r );
}
#endif
private: private:
template< class ForwardRange > template< class ForwardRange >
iterator adl_begin( ForwardRange& r ) iterator adl_begin( ForwardRange& r )
@ -250,32 +295,29 @@ namespace boost {
// comparison operators // comparison operators
///////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////
namespace range_detail template< class IteratorT, class ForwardRange >
inline bool operator==( const ForwardRange& l,
const iterator_range<IteratorT>& r )
{ {
template< class Left, class Right > return range_detail::equal( l, r );
inline bool equal( const Left& l, const Right& r )
{
BOOST_DEDUCED_TYPENAME range_size<Left>::type
l_size = boost::size( l ),
r_size = boost::size( r );
if( l_size != r_size )
return false;
return std::equal( boost::begin(l), boost::end(l),
boost::begin(r) );
}
template< class Left, class Right >
inline bool less_than( const Left& l, const Right& r )
{
return std::lexicographical_compare( boost::begin(l),
boost::end(l),
boost::begin(r),
boost::end(r) );
}
} }
template< class IteratorT, class ForwardRange >
inline bool operator!=( const ForwardRange& l,
const iterator_range<IteratorT>& r )
{
return !range_detail::equal( l, r );
}
template< class IteratorT, class ForwardRange >
inline bool operator<( const ForwardRange& l,
const iterator_range<IteratorT>& r )
{
return range_detail::less_than( l, r );
}
#ifdef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
#else
template< class Iterator1T, class Iterator2T > template< class Iterator1T, class Iterator2T >
inline bool operator==( const iterator_range<Iterator1T>& l, inline bool operator==( const iterator_range<Iterator1T>& l,
const iterator_range<Iterator2T>& r ) const iterator_range<Iterator2T>& r )
@ -283,19 +325,13 @@ namespace boost {
return range_detail::equal( l, r ); return range_detail::equal( l, r );
} }
template< class IteratorT, class SinglePassRange > template< class IteratorT, class ForwardRange >
inline bool operator==( const iterator_range<IteratorT>& l, inline bool operator==( const iterator_range<IteratorT>& l,
const SinglePassRange& r ) const ForwardRange& r )
{ {
return range_detail::equal( l, r ); return range_detail::equal( l, r );
} }
template< class IteratorT, class SinglePassRange >
inline bool operator==( const SinglePassRange& l,
const iterator_range<IteratorT>& r )
{
return range_detail::equal( l, r );
}
template< class Iterator1T, class Iterator2T > template< class Iterator1T, class Iterator2T >
inline bool operator!=( const iterator_range<Iterator1T>& l, inline bool operator!=( const iterator_range<Iterator1T>& l,
@ -304,16 +340,9 @@ namespace boost {
return !range_detail::equal( l, r ); return !range_detail::equal( l, r );
} }
template< class IteratorT, class SinglePassRange > template< class IteratorT, class ForwardRange >
inline bool operator!=( const iterator_range<IteratorT>& l, inline bool operator!=( const iterator_range<IteratorT>& l,
const SinglePassRange& r ) const ForwardRange& r )
{
return !range_detail::equal( l, r );
}
template< class IteratorT, class SinglePassRange >
inline bool operator!=( const SinglePassRange& l,
const iterator_range<IteratorT>& r )
{ {
return !range_detail::equal( l, r ); return !range_detail::equal( l, r );
} }
@ -333,12 +362,7 @@ namespace boost {
return range_detail::less_than( l, r ); return range_detail::less_than( l, r );
} }
template< class IteratorT, class ForwardRange > #endif // BOOST_NO_FUNCTION_TEMPLATE_ORDERING
inline bool operator<( const ForwardRange& l,
const iterator_range<IteratorT>& r )
{
return range_detail::less_than( l, r );
}
// iterator range utilities -----------------------------------------// // iterator range utilities -----------------------------------------//