blob: a16cf737eae7775ef8e1f0a76c1117f729460074 [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
11#ifndef BOOST_RANGE_DETAIL_END_HPP
12#define BOOST_RANGE_DETAIL_END_HPP
13
14#include <ndnboost/config.hpp> // BOOST_MSVC
15#include <ndnboost/detail/workaround.hpp>
16
17#if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
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>
23# if BOOST_WORKAROUND(BOOST_MSVC, < 1310)
24# 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 >
42 static BOOST_RANGE_DEDUCED_TYPENAME range_iterator<C>::type
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 >
57 static BOOST_RANGE_DEDUCED_TYPENAME range_iterator<P>::type
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 {
71 #if !BOOST_WORKAROUND(BOOST_MSVC, < 1310)
72 template< typename T, std::size_t sz >
73 static T* fun( T BOOST_RANGE_ARRAY_REF()[sz] )
74 {
75 return ndnboost::range_detail::array_end( boost_range_array );
76 }
77 #else
78 template<typename T>
79 static BOOST_RANGE_DEDUCED_TYPENAME remove_extent<T>::type* fun(T& t)
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 >
91 inline BOOST_RANGE_DEDUCED_TYPENAME range_iterator<C>::type
92 end( C& c )
93 {
94 return range_detail::range_end< BOOST_RANGE_DEDUCED_TYPENAME range_detail::range<C>::type >::fun( c );
95 }
96 } // namespace range_adl_barrier
97
98} // namespace 'boost'
99
100# endif // VC6
101#endif