source: NonGTP/Boost/boost/range/rend.hpp @ 857

Revision 857, 1.8 KB checked in by igarcia, 19 years ago (diff)
Line 
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//
10
11#ifndef BOOST_RANGE_REND_HPP
12#define BOOST_RANGE_REND_HPP
13
14#if defined(_MSC_VER) && (_MSC_VER >= 1200)
15# pragma once
16#endif
17
18#include <boost/range/begin.hpp>
19#include <boost/range/reverse_result_iterator.hpp>
20#include <boost/range/reverse_iterator.hpp>
21#include <boost/range/const_reverse_iterator.hpp>
22
23namespace boost
24{
25
26#ifdef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
27
28template< class C >
29inline BOOST_DEDUCED_TYPENAME range_reverse_result_iterator<C>::type
30rend( C& c )
31{
32    return BOOST_DEDUCED_TYPENAME range_reverse_result_iterator<C>::type( begin( c ) );
33}
34
35#else
36
37template< class C >
38inline BOOST_DEDUCED_TYPENAME range_reverse_iterator<
39                                                                typename remove_const<C>::type >::type
40rend( C& c )
41{
42        typedef BOOST_DEDUCED_TYPENAME range_reverse_iterator<
43                                                                typename remove_const<C>::type >::type
44               iter_type;
45    return iter_type( begin( c ) );
46}
47
48template< class C >
49inline BOOST_DEDUCED_TYPENAME range_const_reverse_iterator<C>::type
50rend( const C& c )
51{
52    typedef BOOST_DEDUCED_TYPENAME range_const_reverse_iterator<C>::type
53        iter_type;
54    return iter_type( begin( c ) );
55}
56
57#endif
58
59template< class T >
60inline BOOST_DEDUCED_TYPENAME range_const_reverse_iterator<T>::type
61const_rend( const T& r )
62{
63    return rend( r );
64}
65
66} // namespace 'boost'
67
68#endif
Note: See TracBrowser for help on using the repository browser.