3 // Copyright Thorsten Ottosen 2003-2004. Use, modification and
4 // distribution is subject to the Boost Software License, Version
5 // 1.0. (See accompanying file LICENSE_1_0.txt or copy at
6 // http://www.boost.org/LICENSE_1_0.txt)
8 // For more information, see http://www.boost.org/libs/range/
11 #ifndef BOOST_RANGE_BEGIN_HPP
12 #define BOOST_RANGE_BEGIN_HPP
14 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
18 #include <boost/range/config.hpp>
20 #ifdef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
21 #include <boost/range/detail/begin.hpp>
24 #include <boost/range/iterator.hpp>
29 #if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) && \
30 !BOOST_WORKAROUND(__GNUC__, < 3) \
32 namespace range_detail
36 //////////////////////////////////////////////////////////////////////
38 //////////////////////////////////////////////////////////////////////
40 template< typename C >
41 inline BOOST_DEDUCED_TYPENAME range_iterator<C>::type
45 // If you get a compile-error here, it is most likely because
46 // you have not implemented range_begin() properly in
52 //////////////////////////////////////////////////////////////////////
54 //////////////////////////////////////////////////////////////////////
56 template< typename Iterator >
57 inline Iterator range_begin( const std::pair<Iterator,Iterator>& p )
62 template< typename Iterator >
63 inline Iterator range_begin( std::pair<Iterator,Iterator>& p )
68 //////////////////////////////////////////////////////////////////////
70 //////////////////////////////////////////////////////////////////////
73 // May this be discarded? Or is it needed for bad compilers?
75 template< typename T, std::size_t sz >
76 inline const T* range_begin( const T (&a)[sz] )
81 template< typename T, std::size_t sz >
82 inline T* range_begin( T (&a)[sz] )
88 #if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) && \
89 !BOOST_WORKAROUND(__GNUC__, < 3) \
91 } // namespace 'range_detail'
94 // Use a ADL namespace barrier to avoid ambiguity with other unqualified
95 // calls. This is particularly important with C++0x encouraging
96 // unqualified calls to begin/end.
97 namespace range_adl_barrier
101 inline BOOST_DEDUCED_TYPENAME range_iterator<T>::type begin( T& r )
103 #if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) && \
104 !BOOST_WORKAROUND(__GNUC__, < 3) \
106 using namespace range_detail;
108 return range_begin( r );
112 inline BOOST_DEDUCED_TYPENAME range_iterator<const T>::type begin( const T& r )
114 #if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) && \
115 !BOOST_WORKAROUND(__GNUC__, < 3) \
117 using namespace range_detail;
119 return range_begin( r );
122 } // namespace range_adl_barrier
125 #endif // BOOST_NO_FUNCTION_TEMPLATE_ORDERING
129 namespace range_adl_barrier
132 inline BOOST_DEDUCED_TYPENAME range_iterator<const T>::type
133 const_begin( const T& r )
135 return boost::range_adl_barrier::begin( r );
137 } // namespace range_adl_barrier
139 using namespace range_adl_barrier;