blob: 87f848c6396ea527420afc8817495d1768dbf907 [file] [log] [blame]
Jeff Thompsonef2d5a42013-08-22 19:09:24 -07001// 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 Thompson3d613fd2013-10-15 15:39:04 -070011#ifndef NDNBOOST_RANGE_DETAIL_END_HPP
12#define NDNBOOST_RANGE_DETAIL_END_HPP
Jeff Thompsonef2d5a42013-08-22 19:09:24 -070013
Jeff Thompson3d613fd2013-10-15 15:39:04 -070014#include <ndnboost/config.hpp> // NDNBOOST_MSVC
Jeff Thompsonef2d5a42013-08-22 19:09:24 -070015#include <ndnboost/detail/workaround.hpp>
16
Jeff Thompson3d613fd2013-10-15 15:39:04 -070017#if NDNBOOST_WORKAROUND(NDNBOOST_MSVC, < 1300)
Jeff Thompsonef2d5a42013-08-22 19:09:24 -070018# 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 Thompson3d613fd2013-10-15 15:39:04 -070023# if NDNBOOST_WORKAROUND(NDNBOOST_MSVC, < 1310)
Jeff Thompsonef2d5a42013-08-22 19:09:24 -070024# include <ndnboost/range/detail/remove_extent.hpp>
25# endif
26
27namespace 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 Thompson3d613fd2013-10-15 15:39:04 -070042 static NDNBOOST_RANGE_DEDUCED_TYPENAME range_iterator<C>::type
Jeff Thompsonef2d5a42013-08-22 19:09:24 -070043 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 Thompson3d613fd2013-10-15 15:39:04 -070057 static NDNBOOST_RANGE_DEDUCED_TYPENAME range_iterator<P>::type
Jeff Thompsonef2d5a42013-08-22 19:09:24 -070058 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 Thompson3d613fd2013-10-15 15:39:04 -070071 #if !NDNBOOST_WORKAROUND(NDNBOOST_MSVC, < 1310)
Jeff Thompsonef2d5a42013-08-22 19:09:24 -070072 template< typename T, std::size_t sz >
Jeff Thompson3d613fd2013-10-15 15:39:04 -070073 static T* fun( T NDNBOOST_RANGE_ARRAY_REF()[sz] )
Jeff Thompsonef2d5a42013-08-22 19:09:24 -070074 {
75 return ndnboost::range_detail::array_end( boost_range_array );
76 }
77 #else
78 template<typename T>
Jeff Thompson3d613fd2013-10-15 15:39:04 -070079 static NDNBOOST_RANGE_DEDUCED_TYPENAME remove_extent<T>::type* fun(T& t)
Jeff Thompsonef2d5a42013-08-22 19:09:24 -070080 {
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 Thompson3d613fd2013-10-15 15:39:04 -070091 inline NDNBOOST_RANGE_DEDUCED_TYPENAME range_iterator<C>::type
Jeff Thompsonef2d5a42013-08-22 19:09:24 -070092 end( C& c )
93 {
Jeff Thompson3d613fd2013-10-15 15:39:04 -070094 return range_detail::range_end< NDNBOOST_RANGE_DEDUCED_TYPENAME range_detail::range<C>::type >::fun( c );
Jeff Thompsonef2d5a42013-08-22 19:09:24 -070095 }
96 } // namespace range_adl_barrier
97
98} // namespace 'boost'
99
100# endif // VC6
101#endif