source: NonGTP/Boost/boost/range/detail/size_type.hpp @ 857

Revision 857, 2.9 KB checked in by igarcia, 18 years ago (diff)
Line 
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_SIZE_TYPE_HPP
12#define BOOST_RANGE_DETAIL_SIZE_TYPE_HPP
13
14#include <boost/range/detail/common.hpp>
15
16//////////////////////////////////////////////////////////////////////////////
17// missing partial specialization  workaround.
18//////////////////////////////////////////////////////////////////////////////
19
20namespace boost
21{
22    namespace range_detail
23    {       
24        template< typename T >
25        struct range_size_type_;
26
27        template<>
28        struct range_size_type_<std_container_>
29        {
30            template< typename C >
31            struct pts
32            {
33                typedef BOOST_RANGE_DEDUCED_TYPENAME C::size_type type;
34            };
35        };
36
37        template<>
38        struct range_size_type_<std_pair_>
39        {
40            template< typename P >
41            struct pts
42            {
43                typedef std::size_t type;
44            };
45        };
46
47        template<>
48        struct range_size_type_<array_>
49        {
50            template< typename A >
51            struct pts
52            {
53                typedef std::size_t type;
54            };
55        };
56
57        template<>
58        struct range_size_type_<char_array_>
59        {
60            template< typename A >
61            struct pts
62            {
63                typedef std::size_t type;
64            };
65        };
66
67        template<>
68        struct range_size_type_<char_ptr_>
69        {
70            template< typename S >
71            struct pts
72            {
73                typedef std::size_t type;
74            };         
75        };
76       
77        template<>
78        struct range_size_type_<const_char_ptr_>
79        {
80            template< typename S >
81            struct pts
82            {
83                typedef std::size_t type;
84            };         
85        };
86       
87        template<>
88        struct range_size_type_<wchar_t_ptr_>
89        {
90            template< typename S >
91            struct pts
92            {
93                typedef std::size_t type;
94            };         
95        };
96       
97        template<>
98        struct range_size_type_<const_wchar_t_ptr_>
99        {
100            template< typename S >
101            struct pts
102            {
103                typedef std::size_t type;
104            };         
105        }; 
106    }
107   
108    template< typename C >
109    class range_size
110    {
111        typedef typename range_detail::range<C>::type c_type;
112    public:
113        typedef typename range_detail::range_size_type_<c_type>::BOOST_NESTED_TEMPLATE pts<C>::type type;
114    };
115}
116
117#endif
118
Note: See TracBrowser for help on using the repository browser.