Brian Silverman | 598d029 | 2018-08-04 23:56:47 -0700 | [diff] [blame^] | 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_DETAIL_END_HPP |
| 12 | #define BOOST_RANGE_DETAIL_END_HPP |
| 13 | |
| 14 | #include <boost/config.hpp> // BOOST_MSVC |
| 15 | #include <boost/detail/workaround.hpp> |
| 16 | |
| 17 | #include <boost/range/detail/implementation_help.hpp> |
| 18 | #include <boost/range/iterator.hpp> |
| 19 | #include <boost/range/detail/common.hpp> |
| 20 | |
| 21 | namespace boost |
| 22 | { |
| 23 | namespace range_detail |
| 24 | { |
| 25 | template< typename T > |
| 26 | struct range_end; |
| 27 | |
| 28 | ////////////////////////////////////////////////////////////////////// |
| 29 | // default |
| 30 | ////////////////////////////////////////////////////////////////////// |
| 31 | |
| 32 | template<> |
| 33 | struct range_end<std_container_> |
| 34 | { |
| 35 | template< typename C > |
| 36 | BOOST_CONSTEXPR static BOOST_RANGE_DEDUCED_TYPENAME range_iterator<C>::type |
| 37 | fun( C& c ) |
| 38 | { |
| 39 | return c.end(); |
| 40 | }; |
| 41 | }; |
| 42 | |
| 43 | ////////////////////////////////////////////////////////////////////// |
| 44 | // pair |
| 45 | ////////////////////////////////////////////////////////////////////// |
| 46 | |
| 47 | template<> |
| 48 | struct range_end<std_pair_> |
| 49 | { |
| 50 | template< typename P > |
| 51 | BOOST_CONSTEXPR static BOOST_RANGE_DEDUCED_TYPENAME range_iterator<P>::type |
| 52 | fun( const P& p ) |
| 53 | { |
| 54 | return p.second; |
| 55 | } |
| 56 | }; |
| 57 | |
| 58 | ////////////////////////////////////////////////////////////////////// |
| 59 | // array |
| 60 | ////////////////////////////////////////////////////////////////////// |
| 61 | |
| 62 | template<> |
| 63 | struct range_end<array_> |
| 64 | { |
| 65 | template<typename T> |
| 66 | BOOST_CONSTEXPR static BOOST_RANGE_DEDUCED_TYPENAME remove_extent<T>::type* fun(T& t) |
| 67 | { |
| 68 | return t + remove_extent<T>::size; |
| 69 | } |
| 70 | }; |
| 71 | |
| 72 | } // namespace 'range_detail' |
| 73 | |
| 74 | namespace range_adl_barrier |
| 75 | { |
| 76 | template< typename C > |
| 77 | BOOST_CONSTEXPR inline BOOST_RANGE_DEDUCED_TYPENAME range_iterator<C>::type |
| 78 | end( C& c ) |
| 79 | { |
| 80 | return range_detail::range_end< BOOST_RANGE_DEDUCED_TYPENAME range_detail::range<C>::type >::fun( c ); |
| 81 | } |
| 82 | } // namespace range_adl_barrier |
| 83 | |
| 84 | } // namespace 'boost' |
| 85 | |
| 86 | #endif |