mirror of
https://github.com/boostorg/iterator.git
synced 2025-05-11 05:23:52 +00:00
Stop making the incorrect assumption that x == j[n] is legitimate
whenever x = j[n] and x == x are. j[n] may be a proxy convertible to typeof(x) and x == x may use a templated operator==, which wouldn't match the proxy. [SVN r20887]
This commit is contained in:
parent
bdc1304326
commit
522195fd64
@ -25,6 +25,8 @@
|
||||
# include <boost/type_traits.hpp>
|
||||
# include <boost/static_assert.hpp>
|
||||
# include <boost/concept_archetype.hpp> // for detail::dummy_constructor
|
||||
# include <boost/implicit_cast.hpp>
|
||||
# include <boost/type_traits/broken_compiler_spec.hpp>
|
||||
|
||||
namespace boost {
|
||||
|
||||
@ -38,6 +40,11 @@ struct dummyT {
|
||||
int m_x;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
BOOST_TT_BROKEN_COMPILER_SPEC(boost::dummyT)
|
||||
|
||||
namespace boost {
|
||||
|
||||
// Tests whether type Iterator satisfies the requirements for a
|
||||
// TrivialIterator.
|
||||
@ -211,10 +218,12 @@ void random_access_iterator_test(Iterator i, int N, TrueVals vals)
|
||||
const Iterator j = i;
|
||||
int c;
|
||||
|
||||
typedef typename boost::detail::iterator_traits<Iterator>::value_type value_type;
|
||||
|
||||
for (c = 0; c < N-1; ++c) {
|
||||
assert(i == j + c);
|
||||
assert(*i == vals[c]);
|
||||
assert(*i == j[c]);
|
||||
assert(*i == boost::implicit_cast<value_type>(j[c]));
|
||||
assert(*i == *(j + c));
|
||||
assert(*i == *(c + j));
|
||||
++i;
|
||||
@ -228,7 +237,7 @@ void random_access_iterator_test(Iterator i, int N, TrueVals vals)
|
||||
for (c = 0; c < N-1; ++c) {
|
||||
assert(i == k - c);
|
||||
assert(*i == vals[N - 1 - c]);
|
||||
assert(*i == j[N - 1 - c]);
|
||||
assert(*i == boost::implicit_cast<value_type>(j[N - 1 - c]));
|
||||
Iterator q = k - c;
|
||||
assert(*i == *q);
|
||||
assert(i > j);
|
||||
|
Loading…
x
Reference in New Issue
Block a user