rbegin.hpp 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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. template< class C >
  20. inline BOOST_DEDUCED_TYPENAME range_reverse_iterator<C>::type
  21. rbegin( C& c )
  22. {
  23. typedef BOOST_DEDUCED_TYPENAME range_reverse_iterator<C>::type
  24. iter_type;
  25. return iter_type( boost::end( c ) );
  26. }
  27. template< class C >
  28. inline BOOST_DEDUCED_TYPENAME range_reverse_iterator<const C>::type
  29. rbegin( const C& c )
  30. {
  31. typedef BOOST_DEDUCED_TYPENAME range_reverse_iterator<const C>::type
  32. iter_type;
  33. return iter_type( boost::end( c ) );
  34. }
  35. template< class T >
  36. inline BOOST_DEDUCED_TYPENAME range_reverse_iterator<const T>::type
  37. const_rbegin( const T& r )
  38. {
  39. return boost::rbegin( r );
  40. }
  41. } // namespace 'boost'
  42. #endif