|
2 | 2 | // subject to the Boost Software License, Version 1.0. (See accompanying |
3 | 3 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) |
4 | 4 | #ifndef IS_LVALUE_ITERATOR_DWA2003112_HPP |
5 | | -# define IS_LVALUE_ITERATOR_DWA2003112_HPP |
6 | | - |
7 | | -#include <boost/detail/workaround.hpp> |
| 5 | +#define IS_LVALUE_ITERATOR_DWA2003112_HPP |
8 | 6 |
|
9 | 7 | #include <boost/iterator/detail/type_traits/conjunction.hpp> |
10 | | -#include <boost/mpl/aux_/lambda_support.hpp> |
11 | 8 |
|
12 | 9 | #include <iterator> |
13 | 10 | #include <type_traits> |
14 | 11 |
|
15 | 12 | namespace boost { |
16 | | - |
17 | 13 | namespace iterators { |
18 | | - |
19 | | -namespace detail |
| 14 | +namespace detail { |
| 15 | + |
| 16 | +// Guts of is_lvalue_iterator. It is the iterator type and |
| 17 | +// Value is the iterator's value_type. |
| 18 | +template< typename It, typename Value > |
| 19 | +struct is_lvalue_iterator_impl : |
| 20 | + public detail::conjunction< |
| 21 | + std::is_convertible< decltype(*std::declval< It& >()), typename std::add_lvalue_reference< Value >::type >, |
| 22 | + std::is_lvalue_reference< decltype(*std::declval< It& >()) > |
| 23 | + >::type |
20 | 24 | { |
21 | | - // Guts of is_lvalue_iterator. Value is the iterator's value_type |
22 | | - // and the result is computed in the nested rebind template. |
23 | | - template <class Value> |
24 | | - struct is_lvalue_iterator_impl |
25 | | - { |
26 | | - template <class It> |
27 | | - using DerefT = decltype(*std::declval<It&>()); |
28 | | - |
29 | | - template <class It> |
30 | | - struct rebind : detail::conjunction< |
31 | | - std::is_convertible<DerefT<It>, typename std::add_lvalue_reference<Value>::type> |
32 | | - , std::is_lvalue_reference<DerefT<It>> |
33 | | - >::type |
34 | | - { |
35 | | - }; |
36 | | - }; |
37 | | - |
38 | | - // |
39 | | - // void specializations to handle std input and output iterators |
40 | | - // |
41 | | - template <> |
42 | | - struct is_lvalue_iterator_impl<void> |
43 | | - { |
44 | | - template <class It> |
45 | | - struct rebind : std::false_type |
46 | | - {}; |
47 | | - }; |
| 25 | +}; |
48 | 26 |
|
49 | | -#ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS |
50 | | - template <> |
51 | | - struct is_lvalue_iterator_impl<const void> |
52 | | - { |
53 | | - template <class It> |
54 | | - struct rebind : std::false_type |
55 | | - {}; |
56 | | - }; |
| 27 | +// |
| 28 | +// void specializations to handle std input and output iterators |
| 29 | +// |
| 30 | +template< typename It > |
| 31 | +struct is_lvalue_iterator_impl< It, void > : |
| 32 | + public std::false_type |
| 33 | +{ |
| 34 | +}; |
57 | 35 |
|
58 | | - template <> |
59 | | - struct is_lvalue_iterator_impl<volatile void> |
60 | | - { |
61 | | - template <class It> |
62 | | - struct rebind : std::false_type |
63 | | - {}; |
64 | | - }; |
| 36 | +template< typename It > |
| 37 | +struct is_lvalue_iterator_impl< It, const void > : |
| 38 | + public std::false_type |
| 39 | +{ |
| 40 | +}; |
65 | 41 |
|
66 | | - template <> |
67 | | - struct is_lvalue_iterator_impl<const volatile void> |
68 | | - { |
69 | | - template <class It> |
70 | | - struct rebind : std::false_type |
71 | | - {}; |
72 | | - }; |
73 | | -#endif |
| 42 | +template< typename It > |
| 43 | +struct is_lvalue_iterator_impl< It, volatile void > : |
| 44 | + public std::false_type |
| 45 | +{ |
| 46 | +}; |
74 | 47 |
|
75 | | - // |
76 | | - // This level of dispatching is required for Borland. We might save |
77 | | - // an instantiation by removing it for others. |
78 | | - // |
79 | | - template <class It> |
80 | | - struct is_readable_lvalue_iterator_impl |
81 | | - : is_lvalue_iterator_impl< |
82 | | - BOOST_DEDUCED_TYPENAME std::iterator_traits<It>::value_type const |
83 | | - >::template rebind<It> |
84 | | - {}; |
| 48 | +template< typename It > |
| 49 | +struct is_lvalue_iterator_impl< It, const volatile void > : |
| 50 | + public std::false_type |
| 51 | +{ |
| 52 | +}; |
85 | 53 |
|
86 | | - template <class It> |
87 | | - struct is_non_const_lvalue_iterator_impl |
88 | | - : is_lvalue_iterator_impl< |
89 | | - BOOST_DEDUCED_TYPENAME std::iterator_traits<It>::value_type |
90 | | - >::template rebind<It> |
91 | | - {}; |
92 | 54 | } // namespace detail |
93 | 55 |
|
94 | | -template< typename T > struct is_lvalue_iterator |
95 | | -: public std::integral_constant<bool,::boost::iterators::detail::is_readable_lvalue_iterator_impl<T>::value> |
| 56 | +template< typename T > |
| 57 | +struct is_lvalue_iterator : |
| 58 | + public iterators::detail::is_lvalue_iterator_impl< |
| 59 | + T, |
| 60 | + typename std::iterator_traits< T >::value_type const |
| 61 | + >::type |
96 | 62 | { |
97 | | -public: |
98 | | - BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_lvalue_iterator,(T)) |
99 | 63 | }; |
100 | 64 |
|
101 | | -template< typename T > struct is_non_const_lvalue_iterator |
102 | | -: public std::integral_constant<bool,::boost::iterators::detail::is_non_const_lvalue_iterator_impl<T>::value> |
| 65 | +template< typename T > |
| 66 | +struct is_non_const_lvalue_iterator : |
| 67 | + public iterators::detail::is_lvalue_iterator_impl< |
| 68 | + T, |
| 69 | + typename std::iterator_traits< T >::value_type |
| 70 | + >::type |
103 | 71 | { |
104 | | -public: |
105 | | - BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_non_const_lvalue_iterator,(T)) |
106 | 72 | }; |
107 | 73 |
|
108 | 74 | } // namespace iterators |
|
0 commit comments