Removed dependency on MPL from is_lvalue_iterator.hpp.

Also removed workarounds for older compilers and simplified implementation.
This commit is contained in:
Andrey Semashev 2025-01-28 00:29:35 +03:00
parent dec7d0f24c
commit 6fab3bbfa4

View File

@ -4,105 +4,71 @@
#ifndef IS_LVALUE_ITERATOR_DWA2003112_HPP #ifndef IS_LVALUE_ITERATOR_DWA2003112_HPP
#define IS_LVALUE_ITERATOR_DWA2003112_HPP #define IS_LVALUE_ITERATOR_DWA2003112_HPP
#include <boost/detail/workaround.hpp>
#include <boost/iterator/detail/type_traits/conjunction.hpp> #include <boost/iterator/detail/type_traits/conjunction.hpp>
#include <boost/mpl/aux_/lambda_support.hpp>
#include <iterator> #include <iterator>
#include <type_traits> #include <type_traits>
namespace boost { namespace boost {
namespace iterators { namespace iterators {
namespace detail {
namespace detail // Guts of is_lvalue_iterator. It is the iterator type and
{ // Value is the iterator's value_type.
// Guts of is_lvalue_iterator. Value is the iterator's value_type template< typename It, typename Value >
// and the result is computed in the nested rebind template. struct is_lvalue_iterator_impl :
template <class Value> public detail::conjunction<
struct is_lvalue_iterator_impl std::is_convertible< decltype(*std::declval< It& >()), typename std::add_lvalue_reference< Value >::type >,
{ std::is_lvalue_reference< decltype(*std::declval< It& >()) >
template <class It>
using DerefT = decltype(*std::declval<It&>());
template <class It>
struct rebind : detail::conjunction<
std::is_convertible<DerefT<It>, typename std::add_lvalue_reference<Value>::type>
, std::is_lvalue_reference<DerefT<It>>
>::type >::type
{ {
}; };
};
// //
// void specializations to handle std input and output iterators // void specializations to handle std input and output iterators
// //
template <> template< typename It >
struct is_lvalue_iterator_impl<void> struct is_lvalue_iterator_impl< It, void > :
public std::false_type
{ {
template <class It>
struct rebind : std::false_type
{};
}; };
#ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS template< typename It >
template <> struct is_lvalue_iterator_impl< It, const void > :
struct is_lvalue_iterator_impl<const void> public std::false_type
{ {
template <class It>
struct rebind : std::false_type
{};
}; };
template <> template< typename It >
struct is_lvalue_iterator_impl<volatile void> struct is_lvalue_iterator_impl< It, volatile void > :
public std::false_type
{ {
template <class It>
struct rebind : std::false_type
{};
}; };
template <> template< typename It >
struct is_lvalue_iterator_impl<const volatile void> struct is_lvalue_iterator_impl< It, const volatile void > :
public std::false_type
{ {
template <class It>
struct rebind : std::false_type
{};
}; };
#endif
//
// This level of dispatching is required for Borland. We might save
// an instantiation by removing it for others.
//
template <class It>
struct is_readable_lvalue_iterator_impl
: is_lvalue_iterator_impl<
BOOST_DEDUCED_TYPENAME std::iterator_traits<It>::value_type const
>::template rebind<It>
{};
template <class It>
struct is_non_const_lvalue_iterator_impl
: is_lvalue_iterator_impl<
BOOST_DEDUCED_TYPENAME std::iterator_traits<It>::value_type
>::template rebind<It>
{};
} // namespace detail } // namespace detail
template< typename T > struct is_lvalue_iterator template< typename T >
: public std::integral_constant<bool,::boost::iterators::detail::is_readable_lvalue_iterator_impl<T>::value> struct is_lvalue_iterator :
public iterators::detail::is_lvalue_iterator_impl<
T,
typename std::iterator_traits< T >::value_type const
>::type
{ {
public:
BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_lvalue_iterator,(T))
}; };
template< typename T > struct is_non_const_lvalue_iterator template< typename T >
: public std::integral_constant<bool,::boost::iterators::detail::is_non_const_lvalue_iterator_impl<T>::value> struct is_non_const_lvalue_iterator :
public iterators::detail::is_lvalue_iterator_impl<
T,
typename std::iterator_traits< T >::value_type
>::type
{ {
public:
BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_non_const_lvalue_iterator,(T))
}; };
} // namespace iterators } // namespace iterators