rbegin.hpp 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. #ifndef BOOST_RANGE_RBEGIN_HPP
  11. #define BOOST_RANGE_RBEGIN_HPP
  12. #if defined(_MSC_VER)
  13. # pragma once
  14. #endif
  15. #include <boost/range/end.hpp>
  16. #include <boost/range/reverse_iterator.hpp>
  17. namespace boost
  18. {
  19. #ifdef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
  20. template< class C >
  21. inline BOOST_DEDUCED_TYPENAME range_reverse_iterator<C>::type
  22. rbegin( C& c )
  23. {
  24. return BOOST_DEDUCED_TYPENAME range_reverse_iterator<C>::type( boost::end( c ) );
  25. }
  26. #else
  27. template< class C >
  28. inline BOOST_DEDUCED_TYPENAME range_reverse_iterator<C>::type
  29. rbegin( C& c )
  30. {
  31. typedef BOOST_DEDUCED_TYPENAME range_reverse_iterator<C>::type
  32. iter_type;
  33. return iter_type( boost::end( c ) );
  34. }
  35. template< class C >
  36. inline BOOST_DEDUCED_TYPENAME range_reverse_iterator<const C>::type
  37. rbegin( const C& c )
  38. {
  39. typedef BOOST_DEDUCED_TYPENAME range_reverse_iterator<const C>::type
  40. iter_type;
  41. return iter_type( boost::end( c ) );
  42. }
  43. #endif // BOOST_NO_FUNCTION_TEMPLATE_ORDERING
  44. template< class T >
  45. inline BOOST_DEDUCED_TYPENAME range_reverse_iterator<const T>::type
  46. const_rbegin( const T& r )
  47. {
  48. return boost::rbegin( r );
  49. }
  50. } // namespace 'boost'
  51. #endif