Jeff Thompson | ef2d5a4 | 2013-08-22 19:09:24 -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 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 11 | #ifndef NDNBOOST_RANGE_DETAIL_END_HPP |
| 12 | #define NDNBOOST_RANGE_DETAIL_END_HPP |
Jeff Thompson | ef2d5a4 | 2013-08-22 19:09:24 -0700 | [diff] [blame] | 13 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 14 | #include <ndnboost/config.hpp> // NDNBOOST_MSVC |
Jeff Thompson | ef2d5a4 | 2013-08-22 19:09:24 -0700 | [diff] [blame] | 15 | #include <ndnboost/detail/workaround.hpp> |
| 16 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 17 | #if NDNBOOST_WORKAROUND(NDNBOOST_MSVC, < 1300) |
Jeff Thompson | ef2d5a4 | 2013-08-22 19:09:24 -0700 | [diff] [blame] | 18 | # include <ndnboost/range/detail/vc6/end.hpp> |
| 19 | #else |
| 20 | # include <ndnboost/range/detail/implementation_help.hpp> |
| 21 | # include <ndnboost/range/iterator.hpp> |
| 22 | # include <ndnboost/range/detail/common.hpp> |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 23 | # if NDNBOOST_WORKAROUND(NDNBOOST_MSVC, < 1310) |
Jeff Thompson | ef2d5a4 | 2013-08-22 19:09:24 -0700 | [diff] [blame] | 24 | # include <ndnboost/range/detail/remove_extent.hpp> |
| 25 | # endif |
| 26 | |
| 27 | namespace ndnboost |
| 28 | { |
| 29 | namespace range_detail |
| 30 | { |
| 31 | template< typename T > |
| 32 | struct range_end; |
| 33 | |
| 34 | ////////////////////////////////////////////////////////////////////// |
| 35 | // default |
| 36 | ////////////////////////////////////////////////////////////////////// |
| 37 | |
| 38 | template<> |
| 39 | struct range_end<std_container_> |
| 40 | { |
| 41 | template< typename C > |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 42 | static NDNBOOST_RANGE_DEDUCED_TYPENAME range_iterator<C>::type |
Jeff Thompson | ef2d5a4 | 2013-08-22 19:09:24 -0700 | [diff] [blame] | 43 | fun( C& c ) |
| 44 | { |
| 45 | return c.end(); |
| 46 | }; |
| 47 | }; |
| 48 | |
| 49 | ////////////////////////////////////////////////////////////////////// |
| 50 | // pair |
| 51 | ////////////////////////////////////////////////////////////////////// |
| 52 | |
| 53 | template<> |
| 54 | struct range_end<std_pair_> |
| 55 | { |
| 56 | template< typename P > |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 57 | static NDNBOOST_RANGE_DEDUCED_TYPENAME range_iterator<P>::type |
Jeff Thompson | ef2d5a4 | 2013-08-22 19:09:24 -0700 | [diff] [blame] | 58 | fun( const P& p ) |
| 59 | { |
| 60 | return p.second; |
| 61 | } |
| 62 | }; |
| 63 | |
| 64 | ////////////////////////////////////////////////////////////////////// |
| 65 | // array |
| 66 | ////////////////////////////////////////////////////////////////////// |
| 67 | |
| 68 | template<> |
| 69 | struct range_end<array_> |
| 70 | { |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 71 | #if !NDNBOOST_WORKAROUND(NDNBOOST_MSVC, < 1310) |
Jeff Thompson | ef2d5a4 | 2013-08-22 19:09:24 -0700 | [diff] [blame] | 72 | template< typename T, std::size_t sz > |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 73 | static T* fun( T NDNBOOST_RANGE_ARRAY_REF()[sz] ) |
Jeff Thompson | ef2d5a4 | 2013-08-22 19:09:24 -0700 | [diff] [blame] | 74 | { |
| 75 | return ndnboost::range_detail::array_end( boost_range_array ); |
| 76 | } |
| 77 | #else |
| 78 | template<typename T> |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 79 | static NDNBOOST_RANGE_DEDUCED_TYPENAME remove_extent<T>::type* fun(T& t) |
Jeff Thompson | ef2d5a4 | 2013-08-22 19:09:24 -0700 | [diff] [blame] | 80 | { |
| 81 | return t + remove_extent<T>::size; |
| 82 | } |
| 83 | #endif |
| 84 | }; |
| 85 | |
| 86 | } // namespace 'range_detail' |
| 87 | |
| 88 | namespace range_adl_barrier |
| 89 | { |
| 90 | template< typename C > |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 91 | inline NDNBOOST_RANGE_DEDUCED_TYPENAME range_iterator<C>::type |
Jeff Thompson | ef2d5a4 | 2013-08-22 19:09:24 -0700 | [diff] [blame] | 92 | end( C& c ) |
| 93 | { |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 94 | return range_detail::range_end< NDNBOOST_RANGE_DEDUCED_TYPENAME range_detail::range<C>::type >::fun( c ); |
Jeff Thompson | ef2d5a4 | 2013-08-22 19:09:24 -0700 | [diff] [blame] | 95 | } |
| 96 | } // namespace range_adl_barrier |
| 97 | |
| 98 | } // namespace 'boost' |
| 99 | |
| 100 | # endif // VC6 |
| 101 | #endif |