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

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