fix doc example typo
[boost.git] / boost / range / end.hpp
blob3063c02c650a424ba0379ad4ebf97aa9aeac8d9e
1 // Boost.Range library
2 //
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)
7 //
8 // For more information, see http://www.boost.org/libs/range/
9 //
11 #ifndef BOOST_RANGE_END_HPP
12 #define BOOST_RANGE_END_HPP
14 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
15 # pragma once
16 #endif
18 #include <boost/range/config.hpp>
20 #ifdef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
21 #include <boost/range/detail/end.hpp>
22 #else
24 #include <boost/range/detail/implementation_help.hpp>
25 #include <boost/range/iterator.hpp>
26 #include <boost/range/const_iterator.hpp>
28 namespace boost
31 #if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) && \
32 !BOOST_WORKAROUND(__GNUC__, < 3) \
33 /**/
34 namespace range_detail
36 #endif
38 //////////////////////////////////////////////////////////////////////
39 // primary template
40 //////////////////////////////////////////////////////////////////////
41 template< typename C >
42 inline BOOST_DEDUCED_TYPENAME range_iterator<C>::type
43 range_end( C& c )
46 // If you get a compile-error here, it is most likely because
47 // you have not implemented range_begin() properly in
48 // the namespace of C
50 return c.end();
53 //////////////////////////////////////////////////////////////////////
54 // pair
55 //////////////////////////////////////////////////////////////////////
57 template< typename Iterator >
58 inline Iterator range_end( const std::pair<Iterator,Iterator>& p )
60 return p.second;
63 template< typename Iterator >
64 inline Iterator range_end( std::pair<Iterator,Iterator>& p )
66 return p.second;
69 //////////////////////////////////////////////////////////////////////
70 // array
71 //////////////////////////////////////////////////////////////////////
73 template< typename T, std::size_t sz >
74 inline const T* range_end( const T (&a)[sz] )
76 return range_detail::array_end<T,sz>( a );
79 template< typename T, std::size_t sz >
80 inline T* range_end( T (&a)[sz] )
82 return range_detail::array_end<T,sz>( a );
85 #if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) && \
86 !BOOST_WORKAROUND(__GNUC__, < 3) \
87 /**/
88 } // namespace 'range_detail'
89 #endif
91 template< class T >
92 inline BOOST_DEDUCED_TYPENAME range_iterator<T>::type end( T& r )
94 #if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) && \
95 !BOOST_WORKAROUND(__GNUC__, < 3) \
96 /**/
97 using namespace range_detail;
98 #endif
99 return range_end( r );
102 template< class T >
103 inline BOOST_DEDUCED_TYPENAME range_iterator<const T>::type end( const T& r )
105 #if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) && \
106 !BOOST_WORKAROUND(__GNUC__, < 3) \
107 /**/
108 using namespace range_detail;
109 #endif
110 return range_end( r );
113 } // namespace 'boost'
117 #endif // BOOST_NO_FUNCTION_TEMPLATE_ORDERING
120 namespace boost
122 template< class T >
123 inline BOOST_DEDUCED_TYPENAME range_iterator<const T>::type
124 const_end( const T& r )
126 return boost::end( r );
130 #endif