2004-06-29 02:50:07 +00:00
|
|
|
// Boost.Range library
|
|
|
|
//
|
|
|
|
// Copyright Thorsten Ottosen 2003-2004. Use, modification and
|
|
|
|
// distribution is subject to the Boost Software License, Version
|
|
|
|
// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
|
|
|
// http://www.boost.org/LICENSE_1_0.txt)
|
|
|
|
//
|
|
|
|
// For more information, see http://www.boost.org/libs/range/
|
|
|
|
//
|
|
|
|
|
|
|
|
#ifndef BOOST_RANGE_BEGIN_HPP
|
|
|
|
#define BOOST_RANGE_BEGIN_HPP
|
|
|
|
|
|
|
|
#if defined(_MSC_VER) && (_MSC_VER >= 1200)
|
|
|
|
# pragma once
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <boost/range/config.hpp>
|
|
|
|
|
|
|
|
#ifdef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
|
|
|
|
#include <boost/range/detail/begin.hpp>
|
|
|
|
#else
|
|
|
|
|
|
|
|
#include <boost/range/iterator.hpp>
|
|
|
|
|
2005-05-30 07:35:51 +00:00
|
|
|
namespace boost
|
2004-06-29 02:50:07 +00:00
|
|
|
{
|
2005-03-24 11:23:04 +00:00
|
|
|
|
2005-05-30 07:35:51 +00:00
|
|
|
#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) && \
|
|
|
|
!BOOST_WORKAROUND(__GNUC__, < 3) \
|
|
|
|
/**/
|
|
|
|
namespace range_detail
|
2004-06-29 02:50:07 +00:00
|
|
|
{
|
2005-03-24 11:23:04 +00:00
|
|
|
#endif
|
2005-05-30 07:35:51 +00:00
|
|
|
|
2004-06-29 02:50:07 +00:00
|
|
|
//////////////////////////////////////////////////////////////////////
|
2004-08-10 16:05:53 +00:00
|
|
|
// primary template
|
2004-06-29 02:50:07 +00:00
|
|
|
//////////////////////////////////////////////////////////////////////
|
2005-05-30 07:35:51 +00:00
|
|
|
|
2004-06-29 02:50:07 +00:00
|
|
|
template< typename C >
|
2006-05-18 20:52:17 +00:00
|
|
|
inline BOOST_DEDUCED_TYPENAME range_iterator<C>::type
|
2007-10-23 19:07:38 +00:00
|
|
|
boost_range_begin( C& c )
|
2004-06-29 02:50:07 +00:00
|
|
|
{
|
2005-05-30 07:35:51 +00:00
|
|
|
return c.begin();
|
2004-06-29 02:50:07 +00:00
|
|
|
}
|
2005-05-30 07:35:51 +00:00
|
|
|
|
2004-06-29 02:50:07 +00:00
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
// pair
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
2005-05-30 07:35:51 +00:00
|
|
|
|
2004-06-29 02:50:07 +00:00
|
|
|
template< typename Iterator >
|
2007-10-23 19:07:38 +00:00
|
|
|
inline Iterator boost_range_begin( const std::pair<Iterator,Iterator>& p )
|
2004-06-29 02:50:07 +00:00
|
|
|
{
|
|
|
|
return p.first;
|
|
|
|
}
|
2005-05-30 07:35:51 +00:00
|
|
|
|
2004-06-29 02:50:07 +00:00
|
|
|
template< typename Iterator >
|
2007-10-23 19:07:38 +00:00
|
|
|
inline Iterator boost_range_begin( std::pair<Iterator,Iterator>& p )
|
2004-06-29 02:50:07 +00:00
|
|
|
{
|
|
|
|
return p.first;
|
|
|
|
}
|
2005-05-30 07:35:51 +00:00
|
|
|
|
2004-06-29 02:50:07 +00:00
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
// array
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
2005-05-30 07:35:51 +00:00
|
|
|
|
2006-05-18 20:52:17 +00:00
|
|
|
//
|
|
|
|
// May this be discarded? Or is it needed for bad compilers?
|
|
|
|
//
|
2004-06-29 02:50:07 +00:00
|
|
|
template< typename T, std::size_t sz >
|
2007-10-23 19:07:38 +00:00
|
|
|
inline const T* boost_range_begin( const T (&array)[sz] )
|
2004-06-29 02:50:07 +00:00
|
|
|
{
|
|
|
|
return array;
|
|
|
|
}
|
2005-05-30 07:35:51 +00:00
|
|
|
|
2004-06-29 02:50:07 +00:00
|
|
|
template< typename T, std::size_t sz >
|
2007-10-23 19:07:38 +00:00
|
|
|
inline T* boost_range_begin( T (&array)[sz] )
|
2004-06-29 02:50:07 +00:00
|
|
|
{
|
|
|
|
return array;
|
|
|
|
}
|
2005-05-30 07:35:51 +00:00
|
|
|
|
|
|
|
|
|
|
|
#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) && \
|
|
|
|
!BOOST_WORKAROUND(__GNUC__, < 3) \
|
|
|
|
/**/
|
2004-08-16 22:07:07 +00:00
|
|
|
} // namespace 'range_detail'
|
2005-03-24 11:23:04 +00:00
|
|
|
#endif
|
2004-06-29 02:50:07 +00:00
|
|
|
|
2004-08-10 16:05:53 +00:00
|
|
|
|
|
|
|
template< class T >
|
2006-05-18 20:52:17 +00:00
|
|
|
inline BOOST_DEDUCED_TYPENAME range_iterator<T>::type begin( T& r )
|
2004-08-10 16:05:53 +00:00
|
|
|
{
|
2005-05-30 07:35:51 +00:00
|
|
|
#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) && \
|
|
|
|
!BOOST_WORKAROUND(__GNUC__, < 3) \
|
|
|
|
/**/
|
|
|
|
using namespace range_detail;
|
|
|
|
#endif
|
2007-10-23 19:07:38 +00:00
|
|
|
return boost_range_begin( r );
|
2004-08-10 16:05:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
template< class T >
|
2006-05-18 20:52:17 +00:00
|
|
|
inline BOOST_DEDUCED_TYPENAME range_iterator<const T>::type begin( const T& r )
|
2004-08-10 16:05:53 +00:00
|
|
|
{
|
2005-05-30 07:35:51 +00:00
|
|
|
#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) && \
|
|
|
|
!BOOST_WORKAROUND(__GNUC__, < 3) \
|
|
|
|
/**/
|
|
|
|
using namespace range_detail;
|
|
|
|
#endif
|
2007-10-23 19:07:38 +00:00
|
|
|
return boost_range_begin( r );
|
2004-09-21 19:19:12 +00:00
|
|
|
}
|
|
|
|
|
2004-06-29 02:50:07 +00:00
|
|
|
} // namespace boost
|
|
|
|
|
2005-05-30 07:35:51 +00:00
|
|
|
#endif // BOOST_NO_FUNCTION_TEMPLATE_ORDERING
|
2004-06-29 02:50:07 +00:00
|
|
|
|
2004-09-16 18:21:42 +00:00
|
|
|
namespace boost
|
|
|
|
{
|
|
|
|
template< class T >
|
2006-05-18 20:52:17 +00:00
|
|
|
inline BOOST_DEDUCED_TYPENAME range_iterator<const T>::type
|
2004-09-16 18:21:42 +00:00
|
|
|
const_begin( const T& r )
|
|
|
|
{
|
2006-02-20 21:15:05 +00:00
|
|
|
return boost::begin( r );
|
2004-09-16 18:21:42 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-06-29 02:50:07 +00:00
|
|
|
#endif
|
2006-05-18 20:52:17 +00:00
|
|
|
|