Removed dependency on Boost.Conversion in tests.

This reduces the minimum supported compilers versions.
This commit is contained in:
Andrey Semashev 2023-11-17 04:25:29 +03:00
parent 80bb1ac9e4
commit a9dabd3c65
2 changed files with 8 additions and 7 deletions

View File

@ -22,7 +22,6 @@
# include <iterator> # include <iterator>
# include <boost/static_assert.hpp> # include <boost/static_assert.hpp>
# include <boost/concept_archetype.hpp> // for detail::dummy_constructor # include <boost/concept_archetype.hpp> // for detail::dummy_constructor
# include <boost/implicit_cast.hpp>
# include <boost/core/ignore_unused.hpp> # include <boost/core/ignore_unused.hpp>
# include <boost/core/lightweight_test.hpp> # include <boost/core/lightweight_test.hpp>
# include <boost/type_traits/is_same.hpp> # include <boost/type_traits/is_same.hpp>
@ -223,12 +222,15 @@ void random_access_iterator_test(Iterator i, int N, TrueVals vals)
int c; int c;
typedef typename std::iterator_traits<Iterator>::value_type value_type; typedef typename std::iterator_traits<Iterator>::value_type value_type;
boost::ignore_unused<value_type>(); struct local
{
static value_type to_value_type(value_type v) { return v; }
};
for (c = 0; c < N-1; ++c) { for (c = 0; c < N-1; ++c) {
BOOST_TEST(i == j + c); BOOST_TEST(i == j + c);
BOOST_TEST(*i == vals[c]); BOOST_TEST(*i == vals[c]);
BOOST_TEST(*i == boost::implicit_cast<value_type>(j[c])); BOOST_TEST(*i == local::to_value_type(j[c]));
BOOST_TEST(*i == *(j + c)); BOOST_TEST(*i == *(j + c));
BOOST_TEST(*i == *(c + j)); BOOST_TEST(*i == *(c + j));
++i; ++i;
@ -242,7 +244,7 @@ void random_access_iterator_test(Iterator i, int N, TrueVals vals)
for (c = 0; c < N-1; ++c) { for (c = 0; c < N-1; ++c) {
BOOST_TEST(i == k - c); BOOST_TEST(i == k - c);
BOOST_TEST(*i == vals[N - 1 - c]); BOOST_TEST(*i == vals[N - 1 - c]);
BOOST_TEST(*i == boost::implicit_cast<value_type>(j[N - 1 - c])); BOOST_TEST(*i == local::to_value_type(j[N - 1 - c]));
Iterator q = k - c; Iterator q = k - c;
boost::ignore_unused(q); boost::ignore_unused(q);
BOOST_TEST(*i == *q); BOOST_TEST(*i == *q);

View File

@ -8,7 +8,6 @@
#include <boost/iterator/new_iterator_tests.hpp> #include <boost/iterator/new_iterator_tests.hpp>
#include <boost/call_traits.hpp> #include <boost/call_traits.hpp>
#include <boost/polymorphic_cast.hpp>
#include <boost/type_traits/is_convertible.hpp> #include <boost/type_traits/is_convertible.hpp>
#include <boost/core/enable_if.hpp> #include <boost/core/enable_if.hpp>
@ -188,12 +187,12 @@ struct derived : base
virtual void assign(const base &b) virtual void assign(const base &b)
{ {
state = boost::polymorphic_cast<const derived *>(&b)->state; state = dynamic_cast<const derived &>(b).state;
} }
virtual bool equal(const base &b) const virtual bool equal(const base &b) const
{ {
return state == boost::polymorphic_cast<const derived *>(&b)->state; return state == dynamic_cast<const derived &>(b).state;
} }
int state; int state;