mirror of
https://github.com/boostorg/iterator.git
synced 2025-08-02 22:34:28 +02:00
Replace testers with standard metafunctions.
This commit is contained in:
@@ -1,21 +0,0 @@
|
|||||||
// Copyright David Abrahams 2003. Use, modification and distribution is
|
|
||||||
// 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 ANY_CONVERSION_EATER_DWA20031117_HPP
|
|
||||||
# define ANY_CONVERSION_EATER_DWA20031117_HPP
|
|
||||||
|
|
||||||
namespace boost {
|
|
||||||
namespace iterators {
|
|
||||||
namespace detail {
|
|
||||||
|
|
||||||
// This type can be used in traits to "eat" up the one user-defined
|
|
||||||
// implicit conversion allowed.
|
|
||||||
struct any_conversion_eater
|
|
||||||
{
|
|
||||||
template <class T>
|
|
||||||
any_conversion_eater(T const&);
|
|
||||||
};
|
|
||||||
|
|
||||||
}}} // namespace boost::iterators::detail
|
|
||||||
|
|
||||||
#endif // ANY_CONVERSION_EATER_DWA20031117_HPP
|
|
@@ -6,8 +6,6 @@
|
|||||||
|
|
||||||
#include <boost/mpl/aux_/lambda_support.hpp>
|
#include <boost/mpl/aux_/lambda_support.hpp>
|
||||||
|
|
||||||
#include <boost/iterator/detail/any_conversion_eater.hpp>
|
|
||||||
|
|
||||||
#include <iterator>
|
#include <iterator>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
|
|
||||||
@@ -22,9 +20,6 @@ namespace detail
|
|||||||
template <class Value>
|
template <class Value>
|
||||||
struct is_readable_iterator_impl
|
struct is_readable_iterator_impl
|
||||||
{
|
{
|
||||||
static char tester(typename std::add_lvalue_reference<Value>::type, int);
|
|
||||||
static char (& tester(any_conversion_eater, ...) )[2];
|
|
||||||
|
|
||||||
template <class It>
|
template <class It>
|
||||||
struct rebind : std::is_convertible<
|
struct rebind : std::is_convertible<
|
||||||
decltype(*std::declval<It&>())
|
decltype(*std::declval<It&>())
|
||||||
@@ -33,8 +28,6 @@ namespace detail
|
|||||||
{};
|
{};
|
||||||
};
|
};
|
||||||
|
|
||||||
#undef BOOST_READABLE_PRESERVER
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// void specializations to handle std input and output iterators
|
// void specializations to handle std input and output iterators
|
||||||
//
|
//
|
||||||
|
@@ -35,24 +35,10 @@ namespace detail
|
|||||||
{
|
{
|
||||||
typedef typename std::iterator_traits<Iterator>::value_type value_type;
|
typedef typename std::iterator_traits<Iterator>::value_type value_type;
|
||||||
|
|
||||||
struct impl
|
|
||||||
{
|
|
||||||
template <class T>
|
|
||||||
static char test(T const&);
|
|
||||||
|
|
||||||
static char (& test(value_type&) )[2];
|
|
||||||
|
|
||||||
static Iterator& x;
|
|
||||||
};
|
|
||||||
|
|
||||||
BOOST_STATIC_CONSTANT(bool, is_constant = sizeof(impl::test(*impl::x)) == 1);
|
|
||||||
|
|
||||||
typedef typename std::conditional<
|
typedef typename std::conditional<
|
||||||
# if BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x551))
|
std::is_const<
|
||||||
::boost::detail::iterator_pointee<Iterator>::is_constant
|
typename std::remove_reference<decltype(*std::declval<Iterator&>())>::type
|
||||||
# else
|
>::value
|
||||||
is_constant
|
|
||||||
# endif
|
|
||||||
, typename std::add_const<value_type>::type
|
, typename std::add_const<value_type>::type
|
||||||
, value_type
|
, value_type
|
||||||
>::type type;
|
>::type type;
|
||||||
|
Reference in New Issue
Block a user