]> git.donarmstrong.com Git - rsem.git/blob - boost/range/detail/vc6/end.hpp
4f76af5d6bbd1d674851d2571185f41c425a0f91
[rsem.git] / boost / range / detail / vc6 / end.hpp
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_VC6_END_HPP
12 #define BOOST_RANGE_DETAIL_VC6_END_HPP
13
14 #include <boost/range/detail/implementation_help.hpp>
15 #include <boost/range/detail/implementation_help.hpp>
16 #include <boost/range/result_iterator.hpp>
17 #include <boost/range/detail/common.hpp>
18 #include <boost/range/detail/remove_extent.hpp>
19
20 namespace boost 
21 {
22     namespace range_detail
23     {
24         template< typename T >
25         struct range_end;
26
27         //////////////////////////////////////////////////////////////////////
28         // default
29         //////////////////////////////////////////////////////////////////////
30         
31         template<>
32         struct range_end<std_container_>
33         {
34             template< typename C >
35             struct inner {
36                 static BOOST_RANGE_DEDUCED_TYPENAME range_result_iterator<C>::type 
37                 fun( C& c )
38                 {
39                     return c.end();
40                 };
41             };
42         };
43                     
44         //////////////////////////////////////////////////////////////////////
45         // pair
46         //////////////////////////////////////////////////////////////////////
47         
48         template<>
49         struct range_end<std_pair_>
50         {
51             template< typename P >
52             struct inner {
53                 static BOOST_RANGE_DEDUCED_TYPENAME range_result_iterator<P>::type 
54                 fun( const P& p )
55                 {
56                     return p.second;
57                 }
58             };
59         };
60  
61         //////////////////////////////////////////////////////////////////////
62         // array
63         //////////////////////////////////////////////////////////////////////
64         
65         template<>
66         struct range_end<array_>  
67         {
68             template< typename T >
69             struct inner {
70                 static BOOST_DEDUCED_TYPENAME remove_extent<T>::type*
71                 fun(T& t)
72                 {
73                     return t + remove_extent<T>::size;
74                 }
75             };
76         };
77
78                 
79         template<>
80         struct range_end<char_array_>
81         {
82             template< typename T >
83             struct inner {
84                 static BOOST_DEDUCED_TYPENAME remove_extent<T>::type*
85                 fun(T& t)
86                 {
87                     return t + remove_extent<T>::size;
88                 }
89             };
90         };
91         
92         template<>
93         struct range_end<wchar_t_array_>
94         {
95             template< typename T >
96             struct inner {
97                 static BOOST_DEDUCED_TYPENAME remove_extent<T>::type*
98                 fun(T& t)
99                 {
100                     return t + remove_extent<T>::size;
101                 }
102             };
103         };
104
105         //////////////////////////////////////////////////////////////////////
106         // string
107         //////////////////////////////////////////////////////////////////////
108         
109         template<>
110         struct range_end<char_ptr_>
111         {
112             template< typename T >
113             struct inner {
114                 static char* fun( char* s )
115                 {
116                     return boost::range_detail::str_end( s );
117                 }
118             };
119         };
120
121         template<>
122         struct range_end<const_char_ptr_>
123         {
124             template< typename T >
125             struct inner {
126                 static const char* fun( const char* s )
127                 {
128                     return boost::range_detail::str_end( s );
129                 }
130             };
131         };
132
133         template<>
134         struct range_end<wchar_t_ptr_>
135         {
136             template< typename T >
137             struct inner {
138                 static wchar_t* fun( wchar_t* s )
139                 {
140                     return boost::range_detail::str_end( s );
141                 }
142             };
143         };
144
145
146         template<>
147         struct range_end<const_wchar_t_ptr_>
148         {
149             template< typename T >
150             struct inner {
151                 static const wchar_t* fun( const wchar_t* s )
152                 {
153                     return boost::range_detail::str_end( s );
154                 }
155             };
156         };
157         
158     } // namespace 'range_detail'
159     
160     template< typename C >
161     inline BOOST_DEDUCED_TYPENAME range_result_iterator<C>::type 
162     end( C& c )
163     {
164         return range_detail::range_end<range_detail::range<C>::type>::inner<C>::fun( c );
165     }
166     
167 } // namespace 'boost'
168
169
170 #endif