Replace testers with standard metafunctions.

This commit is contained in:
Georgy Guminov
2025-01-25 12:13:05 +03:00
parent bf4cce6114
commit 741a627b73
3 changed files with 4 additions and 46 deletions

View File

@@ -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

View File

@@ -6,8 +6,6 @@
#include <boost/mpl/aux_/lambda_support.hpp>
#include <boost/iterator/detail/any_conversion_eater.hpp>
#include <iterator>
#include <type_traits>
@@ -22,9 +20,6 @@ namespace detail
template <class Value>
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>
struct rebind : std::is_convertible<
decltype(*std::declval<It&>())
@@ -33,8 +28,6 @@ namespace detail
{};
};
#undef BOOST_READABLE_PRESERVER
//
// void specializations to handle std input and output iterators
//

View File

@@ -34,25 +34,11 @@ namespace detail
struct iterator_pointee
{
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<
# if BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x551))
::boost::detail::iterator_pointee<Iterator>::is_constant
# else
is_constant
# endif
std::is_const<
typename std::remove_reference<decltype(*std::declval<Iterator&>())>::type
>::value
, typename std::add_const<value_type>::type
, value_type
>::type type;