Skip to content

Commit cdfdbfc

Browse files
committed
Removed dependency on MPL from is_lvalue_iterator.hpp.
Also removed workarounds for older compilers and simplified implementation.
1 parent f8c570f commit cdfdbfc

File tree

1 file changed

+47
-81
lines changed

1 file changed

+47
-81
lines changed

include/boost/iterator/is_lvalue_iterator.hpp

Lines changed: 47 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -2,107 +2,73 @@
22
// subject to the Boost Software License, Version 1.0. (See accompanying
33
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
44
#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
86

97
#include <boost/iterator/detail/type_traits/conjunction.hpp>
10-
#include <boost/mpl/aux_/lambda_support.hpp>
118

129
#include <iterator>
1310
#include <type_traits>
1411

1512
namespace boost {
16-
1713
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
2024
{
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+
};
4826

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+
};
5735

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+
};
6541

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+
};
7447

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+
};
8553

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-
{};
9254
} // namespace detail
9355

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
9662
{
97-
public:
98-
BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_lvalue_iterator,(T))
9963
};
10064

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
10371
{
104-
public:
105-
BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_non_const_lvalue_iterator,(T))
10672
};
10773

10874
} // namespace iterators

0 commit comments

Comments
 (0)