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 | |
---|
22 | namespace 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 | } |
---|
60 | |
---|
61 | template< typename C > |
---|
62 | class range_value |
---|
63 | { |
---|
64 | typedef BOOST_DEDUCED_TYPENAME range_detail::range<C>::type c_type; |
---|
65 | public: |
---|
66 | typedef BOOST_DEDUCED_TYPENAME range_detail::range_value_type_<c_type>::BOOST_NESTED_TEMPLATE pts<C>::type type; |
---|
67 | }; |
---|
68 | |
---|
69 | } |
---|
70 | |
---|
71 | #endif |
---|
72 | |
---|