summaryrefslogtreecommitdiffstats
blob: 4f76af5d6bbd1d674851d2571185f41c425a0f91 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
// Boost.Range library
//
//  Copyright Thorsten Ottosen 2003-2004. Use, modification and
//  distribution is subject to the Boost Software License, Version
//  1.0. (See accompanying file LICENSE_1_0.txt or copy at
//  http://www.boost.org/LICENSE_1_0.txt)
//
// For more information, see http://www.boost.org/libs/range/
//

#ifndef BOOST_RANGE_DETAIL_VC6_END_HPP
#define BOOST_RANGE_DETAIL_VC6_END_HPP

#include <boost/range/detail/implementation_help.hpp>
#include <boost/range/detail/implementation_help.hpp>
#include <boost/range/result_iterator.hpp>
#include <boost/range/detail/common.hpp>
#include <boost/range/detail/remove_extent.hpp>

namespace boost 
{
    namespace range_detail
    {
        template< typename T >
        struct range_end;

        //////////////////////////////////////////////////////////////////////
        // default
        //////////////////////////////////////////////////////////////////////
        
        template<>
        struct range_end<std_container_>
        {
            template< typename C >
            struct inner {
                static BOOST_RANGE_DEDUCED_TYPENAME range_result_iterator<C>::type 
                fun( C& c )
                {
                    return c.end();
                };
            };
        };
                    
        //////////////////////////////////////////////////////////////////////
        // pair
        //////////////////////////////////////////////////////////////////////
        
        template<>
        struct range_end<std_pair_>
        {
            template< typename P >
            struct inner {
                static BOOST_RANGE_DEDUCED_TYPENAME range_result_iterator<P>::type 
                fun( const P& p )
                {
                    return p.second;
                }
            };
        };
 
        //////////////////////////////////////////////////////////////////////
        // array
        //////////////////////////////////////////////////////////////////////
        
        template<>
        struct range_end<array_>  
        {
            template< typename T >
            struct inner {
                static BOOST_DEDUCED_TYPENAME remove_extent<T>::type*
                fun(T& t)
                {
                    return t + remove_extent<T>::size;
                }
            };
        };

                
        template<>
        struct range_end<char_array_>
        {
            template< typename T >
            struct inner {
                static BOOST_DEDUCED_TYPENAME remove_extent<T>::type*
                fun(T& t)
                {
                    return t + remove_extent<T>::size;
                }
            };
        };
        
        template<>
        struct range_end<wchar_t_array_>
        {
            template< typename T >
            struct inner {
                static BOOST_DEDUCED_TYPENAME remove_extent<T>::type*
                fun(T& t)
                {
                    return t + remove_extent<T>::size;
                }
            };
        };

        //////////////////////////////////////////////////////////////////////
        // string
        //////////////////////////////////////////////////////////////////////
        
        template<>
        struct range_end<char_ptr_>
        {
            template< typename T >
            struct inner {
                static char* fun( char* s )
                {
                    return boost::range_detail::str_end( s );
                }
            };
        };

        template<>
        struct range_end<const_char_ptr_>
        {
            template< typename T >
            struct inner {
                static const char* fun( const char* s )
                {
                    return boost::range_detail::str_end( s );
                }
            };
        };

        template<>
        struct range_end<wchar_t_ptr_>
        {
            template< typename T >
            struct inner {
                static wchar_t* fun( wchar_t* s )
                {
                    return boost::range_detail::str_end( s );
                }
            };
        };


        template<>
        struct range_end<const_wchar_t_ptr_>
        {
            template< typename T >
            struct inner {
                static const wchar_t* fun( const wchar_t* s )
                {
                    return boost::range_detail::str_end( s );
                }
            };
        };
        
    } // namespace 'range_detail'
    
    template< typename C >
    inline BOOST_DEDUCED_TYPENAME range_result_iterator<C>::type 
    end( C& c )
    {
        return range_detail::range_end<range_detail::range<C>::type>::inner<C>::fun( c );
    }
    
} // namespace 'boost'


#endif