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_END_HPP |
| 12 | #define NDNBOOST_RANGE_END_HPP |
Jeff Thompson | ef2d5a4 | 2013-08-22 19:09:24 -0700 | [diff] [blame] | 13 | |
| 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) |
| 15 | # pragma once |
| 16 | #endif |
| 17 | |
| 18 | #include <ndnboost/range/config.hpp> |
| 19 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 20 | #ifdef NDNBOOST_NO_FUNCTION_TEMPLATE_ORDERING |
Jeff Thompson | ef2d5a4 | 2013-08-22 19:09:24 -0700 | [diff] [blame] | 21 | #include <ndnboost/range/detail/end.hpp> |
| 22 | #else |
| 23 | |
| 24 | #include <ndnboost/range/detail/implementation_help.hpp> |
| 25 | #include <ndnboost/range/iterator.hpp> |
| 26 | #include <ndnboost/range/const_iterator.hpp> |
| 27 | |
| 28 | namespace ndnboost |
| 29 | { |
| 30 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 31 | #if !NDNBOOST_WORKAROUND(__BORLANDC__, NDNBOOST_TESTED_AT(0x564)) && \ |
| 32 | !NDNBOOST_WORKAROUND(__GNUC__, < 3) \ |
Jeff Thompson | ef2d5a4 | 2013-08-22 19:09:24 -0700 | [diff] [blame] | 33 | /**/ |
| 34 | namespace range_detail |
| 35 | { |
| 36 | #endif |
| 37 | |
| 38 | ////////////////////////////////////////////////////////////////////// |
| 39 | // primary template |
| 40 | ////////////////////////////////////////////////////////////////////// |
| 41 | template< typename C > |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 42 | inline NDNBOOST_DEDUCED_TYPENAME range_iterator<C>::type |
Jeff Thompson | ef2d5a4 | 2013-08-22 19:09:24 -0700 | [diff] [blame] | 43 | range_end( C& c ) |
| 44 | { |
| 45 | // |
| 46 | // If you get a compile-error here, it is most likely because |
| 47 | // you have not implemented range_begin() properly in |
| 48 | // the namespace of C |
| 49 | // |
| 50 | return c.end(); |
| 51 | } |
| 52 | |
| 53 | ////////////////////////////////////////////////////////////////////// |
| 54 | // pair |
| 55 | ////////////////////////////////////////////////////////////////////// |
| 56 | |
| 57 | template< typename Iterator > |
| 58 | inline Iterator range_end( const std::pair<Iterator,Iterator>& p ) |
| 59 | { |
| 60 | return p.second; |
| 61 | } |
| 62 | |
| 63 | template< typename Iterator > |
| 64 | inline Iterator range_end( std::pair<Iterator,Iterator>& p ) |
| 65 | { |
| 66 | return p.second; |
| 67 | } |
| 68 | |
| 69 | ////////////////////////////////////////////////////////////////////// |
| 70 | // array |
| 71 | ////////////////////////////////////////////////////////////////////// |
| 72 | |
| 73 | template< typename T, std::size_t sz > |
| 74 | inline const T* range_end( const T (&a)[sz] ) |
| 75 | { |
| 76 | return range_detail::array_end<T,sz>( a ); |
| 77 | } |
| 78 | |
| 79 | template< typename T, std::size_t sz > |
| 80 | inline T* range_end( T (&a)[sz] ) |
| 81 | { |
| 82 | return range_detail::array_end<T,sz>( a ); |
| 83 | } |
| 84 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 85 | #if !NDNBOOST_WORKAROUND(__BORLANDC__, NDNBOOST_TESTED_AT(0x564)) && \ |
| 86 | !NDNBOOST_WORKAROUND(__GNUC__, < 3) \ |
Jeff Thompson | ef2d5a4 | 2013-08-22 19:09:24 -0700 | [diff] [blame] | 87 | /**/ |
| 88 | } // namespace 'range_detail' |
| 89 | #endif |
| 90 | |
| 91 | namespace range_adl_barrier |
| 92 | { |
| 93 | |
| 94 | template< class T > |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 95 | inline NDNBOOST_DEDUCED_TYPENAME range_iterator<T>::type end( T& r ) |
Jeff Thompson | ef2d5a4 | 2013-08-22 19:09:24 -0700 | [diff] [blame] | 96 | { |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 97 | #if !NDNBOOST_WORKAROUND(__BORLANDC__, NDNBOOST_TESTED_AT(0x564)) && \ |
| 98 | !NDNBOOST_WORKAROUND(__GNUC__, < 3) \ |
Jeff Thompson | ef2d5a4 | 2013-08-22 19:09:24 -0700 | [diff] [blame] | 99 | /**/ |
| 100 | using namespace range_detail; |
| 101 | #endif |
| 102 | return range_end( r ); |
| 103 | } |
| 104 | |
| 105 | template< class T > |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 106 | inline NDNBOOST_DEDUCED_TYPENAME range_iterator<const T>::type end( const T& r ) |
Jeff Thompson | ef2d5a4 | 2013-08-22 19:09:24 -0700 | [diff] [blame] | 107 | { |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 108 | #if !NDNBOOST_WORKAROUND(__BORLANDC__, NDNBOOST_TESTED_AT(0x564)) && \ |
| 109 | !NDNBOOST_WORKAROUND(__GNUC__, < 3) \ |
Jeff Thompson | ef2d5a4 | 2013-08-22 19:09:24 -0700 | [diff] [blame] | 110 | /**/ |
| 111 | using namespace range_detail; |
| 112 | #endif |
| 113 | return range_end( r ); |
| 114 | } |
| 115 | |
| 116 | } // namespace range_adl_barrier |
| 117 | } // namespace 'boost' |
| 118 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 119 | #endif // NDNBOOST_NO_FUNCTION_TEMPLATE_ORDERING |
Jeff Thompson | ef2d5a4 | 2013-08-22 19:09:24 -0700 | [diff] [blame] | 120 | |
| 121 | namespace ndnboost |
| 122 | { |
| 123 | namespace range_adl_barrier |
| 124 | { |
| 125 | template< class T > |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 126 | inline NDNBOOST_DEDUCED_TYPENAME range_iterator<const T>::type |
Jeff Thompson | ef2d5a4 | 2013-08-22 19:09:24 -0700 | [diff] [blame] | 127 | const_end( const T& r ) |
| 128 | { |
| 129 | return ndnboost::range_adl_barrier::end( r ); |
| 130 | } |
| 131 | } // namespace range_adl_barrier |
| 132 | using namespace range_adl_barrier; |
| 133 | } // namespace ndnboost |
| 134 | |
| 135 | #endif |
| 136 | |