mirror of
https://github.com/boostorg/iterator.git
synced 2025-05-09 23:23:54 +00:00
Removed dependency on MPL from is_lvalue_iterator.hpp.
Also removed workarounds for older compilers and simplified implementation.
This commit is contained in:
parent
dec7d0f24c
commit
6fab3bbfa4
@ -2,107 +2,73 @@
|
||||
// subject to the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
#ifndef IS_LVALUE_ITERATOR_DWA2003112_HPP
|
||||
# define IS_LVALUE_ITERATOR_DWA2003112_HPP
|
||||
|
||||
#include <boost/detail/workaround.hpp>
|
||||
#define IS_LVALUE_ITERATOR_DWA2003112_HPP
|
||||
|
||||
#include <boost/iterator/detail/type_traits/conjunction.hpp>
|
||||
#include <boost/mpl/aux_/lambda_support.hpp>
|
||||
|
||||
#include <iterator>
|
||||
#include <type_traits>
|
||||
|
||||
namespace boost {
|
||||
|
||||
namespace iterators {
|
||||
namespace detail {
|
||||
|
||||
namespace detail
|
||||
// Guts of is_lvalue_iterator. It is the iterator type and
|
||||
// Value is the iterator's value_type.
|
||||
template< typename It, typename Value >
|
||||
struct is_lvalue_iterator_impl :
|
||||
public detail::conjunction<
|
||||
std::is_convertible< decltype(*std::declval< It& >()), typename std::add_lvalue_reference< Value >::type >,
|
||||
std::is_lvalue_reference< decltype(*std::declval< It& >()) >
|
||||
>::type
|
||||
{
|
||||
// Guts of is_lvalue_iterator. Value is the iterator's value_type
|
||||
// and the result is computed in the nested rebind template.
|
||||
template <class Value>
|
||||
struct is_lvalue_iterator_impl
|
||||
{
|
||||
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
|
||||
{
|
||||
};
|
||||
};
|
||||
|
||||
//
|
||||
// void specializations to handle std input and output iterators
|
||||
//
|
||||
template <>
|
||||
struct is_lvalue_iterator_impl<void>
|
||||
{
|
||||
template <class It>
|
||||
struct rebind : std::false_type
|
||||
{};
|
||||
};
|
||||
|
||||
#ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS
|
||||
template <>
|
||||
struct is_lvalue_iterator_impl<const void>
|
||||
{
|
||||
template <class It>
|
||||
struct rebind : std::false_type
|
||||
{};
|
||||
};
|
||||
|
||||
template <>
|
||||
struct is_lvalue_iterator_impl<volatile void>
|
||||
{
|
||||
template <class It>
|
||||
struct rebind : std::false_type
|
||||
{};
|
||||
};
|
||||
|
||||
template <>
|
||||
struct is_lvalue_iterator_impl<const volatile void>
|
||||
{
|
||||
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
|
||||
|
||||
template< typename T > struct is_lvalue_iterator
|
||||
: public std::integral_constant<bool,::boost::iterators::detail::is_readable_lvalue_iterator_impl<T>::value>
|
||||
{
|
||||
public:
|
||||
BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_lvalue_iterator,(T))
|
||||
};
|
||||
|
||||
template< typename T > struct is_non_const_lvalue_iterator
|
||||
: public std::integral_constant<bool,::boost::iterators::detail::is_non_const_lvalue_iterator_impl<T>::value>
|
||||
//
|
||||
// void specializations to handle std input and output iterators
|
||||
//
|
||||
template< typename It >
|
||||
struct is_lvalue_iterator_impl< It, void > :
|
||||
public std::false_type
|
||||
{
|
||||
};
|
||||
|
||||
template< typename It >
|
||||
struct is_lvalue_iterator_impl< It, const void > :
|
||||
public std::false_type
|
||||
{
|
||||
};
|
||||
|
||||
template< typename It >
|
||||
struct is_lvalue_iterator_impl< It, volatile void > :
|
||||
public std::false_type
|
||||
{
|
||||
};
|
||||
|
||||
template< typename It >
|
||||
struct is_lvalue_iterator_impl< It, const volatile void > :
|
||||
public std::false_type
|
||||
{
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
template< typename T >
|
||||
struct is_lvalue_iterator :
|
||||
public iterators::detail::is_lvalue_iterator_impl<
|
||||
T,
|
||||
typename std::iterator_traits< T >::value_type const
|
||||
>::type
|
||||
{
|
||||
};
|
||||
|
||||
template< typename T >
|
||||
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
|
||||
|
Loading…
x
Reference in New Issue
Block a user