forked from boostorg/range
Full merge from trunk at revision 41356 of entire boost-root tree.
[SVN r41369]
This commit is contained in:
@ -15,7 +15,6 @@
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
#include <boost/type_traits/remove_const.hpp>
|
||||
#include <boost/range/config.hpp>
|
||||
|
||||
#ifdef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
|
||||
@ -23,7 +22,6 @@
|
||||
#else
|
||||
|
||||
#include <boost/range/iterator.hpp>
|
||||
#include <boost/range/const_iterator.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
@ -40,17 +38,14 @@ namespace range_detail
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
template< typename C >
|
||||
inline BOOST_DEDUCED_TYPENAME range_const_iterator<C>::type
|
||||
boost_range_begin( const C& c )
|
||||
{
|
||||
return c.begin();
|
||||
}
|
||||
|
||||
template< typename C >
|
||||
inline BOOST_DEDUCED_TYPENAME range_iterator<
|
||||
typename remove_const<C>::type >::type
|
||||
boost_range_begin( C& c )
|
||||
inline BOOST_DEDUCED_TYPENAME range_iterator<C>::type
|
||||
range_begin( C& c )
|
||||
{
|
||||
//
|
||||
// If you get a compile-error here, it is most likely because
|
||||
// you have not implemented range_begin() properly in
|
||||
// the namespace of C
|
||||
//
|
||||
return c.begin();
|
||||
}
|
||||
|
||||
@ -59,13 +54,13 @@ namespace range_detail
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
template< typename Iterator >
|
||||
inline Iterator boost_range_begin( const std::pair<Iterator,Iterator>& p )
|
||||
inline Iterator range_begin( const std::pair<Iterator,Iterator>& p )
|
||||
{
|
||||
return p.first;
|
||||
}
|
||||
|
||||
template< typename Iterator >
|
||||
inline Iterator boost_range_begin( std::pair<Iterator,Iterator>& p )
|
||||
inline Iterator range_begin( std::pair<Iterator,Iterator>& p )
|
||||
{
|
||||
return p.first;
|
||||
}
|
||||
@ -74,66 +69,22 @@ namespace range_detail
|
||||
// array
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
//
|
||||
// May this be discarded? Or is it needed for bad compilers?
|
||||
//
|
||||
template< typename T, std::size_t sz >
|
||||
inline const T* boost_range_begin( const T (&array)[sz] )
|
||||
inline const T* range_begin( const T (&array)[sz] )
|
||||
{
|
||||
return array;
|
||||
}
|
||||
|
||||
template< typename T, std::size_t sz >
|
||||
inline T* boost_range_begin( T (&array)[sz] )
|
||||
inline T* range_begin( T (&array)[sz] )
|
||||
{
|
||||
return array;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// string
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
#if 1 || BOOST_WORKAROUND(__MWERKS__, <= 0x3204 ) || BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
|
||||
// CW up to 9.3 and borland have troubles with function ordering
|
||||
inline const char* boost_range_begin( const char* s )
|
||||
{
|
||||
return s;
|
||||
}
|
||||
|
||||
inline char* boost_range_begin( char* s )
|
||||
{
|
||||
return s;
|
||||
}
|
||||
|
||||
inline const wchar_t* boost_range_begin( const wchar_t* s )
|
||||
{
|
||||
return s;
|
||||
}
|
||||
|
||||
inline wchar_t* boost_range_begin( wchar_t* s )
|
||||
{
|
||||
return s;
|
||||
}
|
||||
#else
|
||||
inline const char* boost_range_begin( const char*& s )
|
||||
{
|
||||
return s;
|
||||
}
|
||||
|
||||
inline char* boost_range_begin( char*& s )
|
||||
{
|
||||
return s;
|
||||
}
|
||||
|
||||
inline const wchar_t* boost_range_begin( const wchar_t*& s )
|
||||
{
|
||||
return s;
|
||||
}
|
||||
|
||||
inline wchar_t* boost_range_begin( wchar_t*& s )
|
||||
{
|
||||
return s;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) && \
|
||||
!BOOST_WORKAROUND(__GNUC__, < 3) \
|
||||
/**/
|
||||
@ -142,44 +93,27 @@ namespace range_detail
|
||||
|
||||
|
||||
template< class T >
|
||||
inline BOOST_DEDUCED_TYPENAME range_iterator<
|
||||
typename remove_const<T>::type >::type begin( T& r )
|
||||
inline BOOST_DEDUCED_TYPENAME range_iterator<T>::type begin( T& r )
|
||||
{
|
||||
#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) && \
|
||||
!BOOST_WORKAROUND(__GNUC__, < 3) \
|
||||
/**/
|
||||
using namespace range_detail;
|
||||
#endif
|
||||
return boost_range_begin( r );
|
||||
return range_begin( r );
|
||||
}
|
||||
|
||||
template< class T >
|
||||
inline BOOST_DEDUCED_TYPENAME range_const_iterator<T>::type begin( const T& r )
|
||||
inline BOOST_DEDUCED_TYPENAME range_iterator<const T>::type begin( const T& r )
|
||||
{
|
||||
#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) && \
|
||||
!BOOST_WORKAROUND(__GNUC__, < 3) \
|
||||
/**/
|
||||
using namespace range_detail;
|
||||
#endif
|
||||
return boost_range_begin( r );
|
||||
return range_begin( r );
|
||||
}
|
||||
|
||||
#if BOOST_WORKAROUND(__MWERKS__, <= 0x3003 ) || BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
|
||||
// BCB and CW are not able to overload pointer when class overloads are also available.
|
||||
template<>
|
||||
inline range_const_iterator<const char*>::type begin<const char*>( const char*& r )
|
||||
{
|
||||
return r;
|
||||
}
|
||||
|
||||
template<>
|
||||
inline range_const_iterator<const wchar_t*>::type begin<const wchar_t*>( const wchar_t*& r )
|
||||
{
|
||||
return r;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_NO_FUNCTION_TEMPLATE_ORDERING
|
||||
@ -187,7 +121,7 @@ inline range_const_iterator<const wchar_t*>::type begin<const wchar_t*>( const w
|
||||
namespace boost
|
||||
{
|
||||
template< class T >
|
||||
inline BOOST_DEDUCED_TYPENAME range_const_iterator<T>::type
|
||||
inline BOOST_DEDUCED_TYPENAME range_iterator<const T>::type
|
||||
const_begin( const T& r )
|
||||
{
|
||||
return boost::begin( r );
|
||||
@ -195,3 +129,4 @@ namespace boost
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
Reference in New Issue
Block a user