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_END_HPP
|
|
|
|
#define BOOST_RANGE_END_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/end.hpp>
|
|
|
|
#else
|
|
|
|
|
|
|
|
#include <boost/range/detail/implementation_help.hpp>
|
|
|
|
#include <boost/range/iterator.hpp>
|
|
|
|
#include <boost/range/const_iterator.hpp>
|
|
|
|
|
2005-12-09 22:22:32 +00:00
|
|
|
namespace boost
|
2005-03-24 11:23:04 +00:00
|
|
|
{
|
2005-12-09 22:22:32 +00:00
|
|
|
|
2005-05-30 07:35:51 +00:00
|
|
|
#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) && \
|
|
|
|
!BOOST_WORKAROUND(__GNUC__, < 3) \
|
2005-12-09 22:22:32 +00:00
|
|
|
/**/
|
2004-08-16 22:07:07 +00:00
|
|
|
namespace range_detail
|
2004-06-29 02:50:07 +00:00
|
|
|
{
|
2005-12-09 22:22:32 +00:00
|
|
|
#endif
|
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
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
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_end( C& c )
|
2004-06-29 02:50:07 +00:00
|
|
|
{
|
|
|
|
return c.end();
|
|
|
|
}
|
2005-12-09 22:22:32 +00:00
|
|
|
|
2004-06-29 02:50:07 +00:00
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
// pair
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
template< typename Iterator >
|
2007-10-23 19:07:38 +00:00
|
|
|
inline Iterator boost_range_end( const std::pair<Iterator,Iterator>& p )
|
2004-06-29 02:50:07 +00:00
|
|
|
{
|
|
|
|
return p.second;
|
|
|
|
}
|
2005-12-09 22:22:32 +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_end( std::pair<Iterator,Iterator>& p )
|
2004-06-29 02:50:07 +00:00
|
|
|
{
|
|
|
|
return p.second;
|
|
|
|
}
|
2005-12-09 22:22:32 +00:00
|
|
|
|
2004-06-29 02:50:07 +00:00
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
// array
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
template< typename T, std::size_t sz >
|
2007-10-23 19:07:38 +00:00
|
|
|
inline const T* boost_range_end( const T (&array)[sz] )
|
2004-06-29 02:50:07 +00:00
|
|
|
{
|
2005-12-09 22:22:32 +00:00
|
|
|
return range_detail::array_end<T,sz>( array );
|
2004-06-29 02:50:07 +00:00
|
|
|
}
|
2005-12-09 22:22:32 +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_end( T (&array)[sz] )
|
2004-06-29 02:50:07 +00:00
|
|
|
{
|
2005-12-09 22:22:32 +00:00
|
|
|
return range_detail::array_end<T,sz>( array );
|
2004-06-29 02:50:07 +00:00
|
|
|
}
|
|
|
|
|
2005-05-30 07:35:51 +00:00
|
|
|
#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) && \
|
|
|
|
!BOOST_WORKAROUND(__GNUC__, < 3) \
|
2005-12-09 22:22:32 +00:00
|
|
|
/**/
|
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 end( 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) \
|
|
|
|
/**/
|
2005-03-24 11:23:04 +00:00
|
|
|
using namespace range_detail;
|
2005-12-09 22:22:32 +00:00
|
|
|
#endif
|
2007-10-23 19:07:38 +00:00
|
|
|
return boost_range_end( 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 end( 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) \
|
|
|
|
/**/
|
2005-03-24 11:23:04 +00:00
|
|
|
using namespace range_detail;
|
2005-12-09 22:22:32 +00:00
|
|
|
#endif
|
2007-10-23 19:07:38 +00:00
|
|
|
return boost_range_end( r );
|
2004-08-10 16:05:53 +00:00
|
|
|
}
|
2004-06-29 02:50:07 +00:00
|
|
|
|
|
|
|
} // namespace 'boost'
|
|
|
|
|
2004-09-02 17:28:57 +00:00
|
|
|
|
|
|
|
|
2004-06-29 02:50:07 +00:00
|
|
|
#endif // BOOST_NO_FUNCTION_TEMPLATE_ORDERING
|
|
|
|
|
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_end( const T& r )
|
|
|
|
{
|
2006-02-20 21:15:05 +00:00
|
|
|
return boost::end( 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
|
|
|
|