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_ITERATOR_HPP |
12 | #define BOOST_RANGE_ITERATOR_HPP |
13 | |
14 | #if defined(_MSC_VER) |
15 | # pragma once |
16 | #endif |
17 | |
18 | #include <boost/range/config.hpp> |
19 | #include <boost/range/range_fwd.hpp> |
20 | #include <boost/range/mutable_iterator.hpp> |
21 | #include <boost/range/const_iterator.hpp> |
22 | #include <boost/type_traits/is_const.hpp> |
23 | #include <boost/type_traits/remove_const.hpp> |
24 | #include <boost/mpl/eval_if.hpp> |
25 | |
26 | namespace boost |
27 | { |
28 | |
29 | #if BOOST_WORKAROUND(BOOST_MSVC, == 1310) |
30 | |
31 | namespace range_detail_vc7_1 |
32 | { |
33 | template< typename C, typename Sig = void(C) > |
34 | struct range_iterator |
35 | { |
36 | typedef BOOST_RANGE_DEDUCED_TYPENAME |
37 | mpl::eval_if_c< is_const<C>::value, |
38 | range_const_iterator< typename remove_const<C>::type >, |
39 | range_mutable_iterator<C> >::type type; |
40 | }; |
41 | |
42 | template< typename C, typename T > |
43 | struct range_iterator< C, void(T[]) > |
44 | { |
45 | typedef T* type; |
46 | }; |
47 | } |
48 | |
49 | #endif |
50 | |
51 | template< typename C, typename Enabler=void > |
52 | struct range_iterator |
53 | { |
54 | #if BOOST_WORKAROUND(BOOST_MSVC, == 1310) |
55 | |
56 | typedef BOOST_RANGE_DEDUCED_TYPENAME |
57 | range_detail_vc7_1::range_iterator<C>::type type; |
58 | |
59 | #else |
60 | |
61 | private: |
62 | typedef typename remove_reference<C>::type param_t; |
63 | |
64 | public: |
65 | typedef typename mpl::eval_if_c< |
66 | is_const<param_t>::value, |
67 | range_const_iterator<typename remove_const<param_t>::type>, |
68 | range_mutable_iterator<param_t> |
69 | >::type type; |
70 | |
71 | #endif |
72 | }; |
73 | |
74 | } // namespace boost |
75 | |
76 | #endif |
77 | |