+2020-02-27 Patrick Palka <ppalka@redhat.com>
+
+ * testsuite/25_algorithms/copy/constrained.cc: Don't assume that the
+ base() of a vector<>::iterator is a pointer.
+ * testsuite/25_algorithms/copy_backward/constrained.cc: Likewise.
+ * testsuite/25_algorithms/move/constrained.cc: Likewise.
+ * testsuite/25_algorithms/move_backward/constrained.cc: Likewise.
+ * testsuite/25_algorithms/inplace_merge/constrained.cc: Use foo.data()
+ instead of &foo[0].
+ * testsuite/25_algorithms/partial_sort/constrained.cc: Likewise.
+ * testsuite/25_algorithms/partial_sort_copy/constrained.cc: Likewise.
+ * testsuite/25_algorithms/shuffle/constrained.cc: Likewise.
+ * testsuite/25_algorithms/sort/constrained.cc: Likewise.
+ * testsuite/25_algorithms/stable_sort/constrained.cc: Likewise.
+
2020-02-27 Jonathan Wakely <jwakely@redhat.com>
* include/debug/array (operator<=>): Define for C++20.
std::vector<int> y(3);
const int z[3] = { 1, 2, 3 };
auto [in, out] = ranges::copy(x, ranges::begin(y));
- VERIFY( in.base() == x.data()+3 );
- VERIFY( out.base() == y.data()+3 );
+ VERIFY( in == x.begin()+3 );
+ VERIFY( out == y.begin()+3 );
VERIFY( ranges::equal(y, z) && ranges::equal(x, z) );
}
std::vector<int> y(3);
const int z[3] = { 1, 2, 3 };
auto [in, out] = ranges::copy(x, ranges::begin(y));
- VERIFY( in.base() == x.data()+3 );
- VERIFY( out.base() == y.data()+3 );
+ VERIFY( in == x.begin()+3 );
+ VERIFY( out == y.begin()+3 );
VERIFY( ranges::equal(y, z) && ranges::equal(x, z) );
}
auto [in,out] = ranges::copy(make_reverse_iterator(x.end()),
make_reverse_iterator(x.begin()),
make_reverse_iterator(y.end()));
- VERIFY( in.base().base() == x.data()+3 );
- VERIFY( out.base().base() == y.data() );
+ VERIFY( in.base() == x.begin()+3 );
+ VERIFY( out.base() == y.begin() );
VERIFY( ranges::equal(y, z) && ranges::equal(x, z) );
}
auto [in,out] = ranges::copy(make_reverse_iterator(x.end()),
make_reverse_iterator(x.begin()),
make_reverse_iterator(y.end()));
- VERIFY( in.base().base() == x.data()+3 );
- VERIFY( out.base().base() == y.data() );
+ VERIFY( in.base() == x.begin()+3 );
+ VERIFY( out.base() == y.begin() );
VERIFY( ranges::equal(y, z) && ranges::equal(x, z) );
}
}
std::vector<int> y(3);
const int z[3] = { 1, 2, 3 };
auto [in, out] = ranges::copy_backward(x, ranges::end(y));
- VERIFY( in.base() == x.data()+3 );
- VERIFY( out.base() == y.data() );
+ VERIFY( in == x.begin()+3 );
+ VERIFY( out == y.begin() );
VERIFY( ranges::equal(y, z) && ranges::equal(x, z) );
}
std::vector<int> y(3);
const int z[3] = { 1, 2, 3 };
auto [in, out] = ranges::copy_backward(x, ranges::end(y));
- VERIFY( in.base() == x.data()+3 );
- VERIFY( out.base() == y.data() );
+ VERIFY( in == x.begin()+3 );
+ VERIFY( out == y.begin() );
VERIFY( ranges::equal(y, z) && ranges::equal(x, z) );
}
auto [in,out] = ranges::copy_backward(make_reverse_iterator(x.end()),
make_reverse_iterator(x.begin()),
make_reverse_iterator(y.begin()));
- VERIFY( in.base().base() == x.data()+3 );
- VERIFY( out.base().base() == y.data()+3 );
+ VERIFY( in.base() == x.begin()+3 );
+ VERIFY( out.base() == y.begin()+3 );
VERIFY( ranges::equal(y, z) && ranges::equal(x, z) );
}
auto [in,out] = ranges::copy_backward(make_reverse_iterator(x.end()),
make_reverse_iterator(x.begin()),
make_reverse_iterator(y.begin()));
- VERIFY( in.base().base() == x.data()+3 );
- VERIFY( out.base().base() == y.data()+3 );
+ VERIFY( in.base() == x.begin()+3 );
+ VERIFY( out.base() == y.begin()+3 );
VERIFY( ranges::equal(y, z) && ranges::equal(x, z) );
}
}
v.insert(v.end(), x, x+j);
ranges::sort(v);
- test_range<int, bidirectional_iterator_wrapper> rz(&v[0], &v[0]+i+j);
+ test_range<int, bidirectional_iterator_wrapper> rz(v.data(), v.data()+i+j);
auto result = ranges::inplace_merge(rz, next(ranges::begin(rz), i));
VERIFY( result == rz.end() );
std::vector<int> y(3);
const int z[3] = { 1, 2, 3 };
auto [in, out] = ranges::move(x, ranges::begin(y));
- VERIFY( in.base() == x.data()+3 );
- VERIFY( out.base() == y.data()+3 );
+ VERIFY( in == x.begin()+3 );
+ VERIFY( out == y.begin()+3 );
VERIFY( ranges::equal(y, z) && ranges::equal(x, z) );
}
std::vector<int> y(3);
const int z[3] = { 1, 2, 3 };
auto [in, out] = ranges::move(x, ranges::begin(y));
- VERIFY( in.base() == x.data()+3 );
- VERIFY( out.base() == y.data()+3 );
+ VERIFY( in == x.begin()+3 );
+ VERIFY( out == y.begin()+3 );
VERIFY( ranges::equal(y, z) && ranges::equal(x, z) );
}
auto [in,out] = ranges::move(make_reverse_iterator(x.end()),
make_reverse_iterator(x.begin()),
make_reverse_iterator(y.end()));
- VERIFY( in.base().base() == x.data()+3 );
- VERIFY( out.base().base() == y.data() );
+ VERIFY( in.base() == x.begin()+3 );
+ VERIFY( out.base() == y.begin() );
VERIFY( ranges::equal(y, z) && ranges::equal(x, z) );
}
auto [in,out] = ranges::move(make_reverse_iterator(x.end()),
make_reverse_iterator(x.begin()),
make_reverse_iterator(y.end()));
- VERIFY( in.base().base() == x.data()+3 );
- VERIFY( out.base().base() == y.data() );
+ VERIFY( in.base() == x.begin()+3 );
+ VERIFY( out.base() == y.begin() );
VERIFY( ranges::equal(y, z) && ranges::equal(x, z) );
}
}
std::vector<int> y(3);
const int z[3] = { 1, 2, 3 };
auto [in, out] = ranges::move_backward(x, ranges::end(y));
- VERIFY( in.base() == x.data()+3 );
- VERIFY( out.base() == y.data() );
+ VERIFY( in == x.begin()+3 );
+ VERIFY( out == y.begin() );
VERIFY( ranges::equal(y, z) && ranges::equal(x, z) );
}
std::vector<int> y(3);
const int z[3] = { 1, 2, 3 };
auto [in, out] = ranges::move_backward(x, ranges::end(y));
- VERIFY( in.base() == x.data()+3 );
- VERIFY( out.base() == y.data() );
+ VERIFY( in == x.begin()+3 );
+ VERIFY( out == y.begin() );
VERIFY( ranges::equal(y, z) && ranges::equal(x, z) );
}
auto [in,out] = ranges::move_backward(make_reverse_iterator(x.end()),
make_reverse_iterator(x.begin()),
make_reverse_iterator(y.begin()));
- VERIFY( in.base().base() == x.data()+3 );
- VERIFY( out.base().base() == y.data()+3 );
+ VERIFY( in.base() == x.begin()+3 );
+ VERIFY( out.base() == y.begin()+3 );
VERIFY( ranges::equal(y, z) && ranges::equal(x, z) );
}
auto [in,out] = ranges::move_backward(make_reverse_iterator(x.end()),
make_reverse_iterator(x.begin()),
make_reverse_iterator(y.begin()));
- VERIFY( in.base().base() == x.data()+3 );
- VERIFY( out.base().base() == y.data()+3 );
+ VERIFY( in.base() == x.begin()+3 );
+ VERIFY( out.base() == y.begin()+3 );
VERIFY( ranges::equal(y, z) && ranges::equal(x, z) );
}
}
std::iota(vref.begin(), vref.end(), 0);
std::vector<int> v1(vref), v2(vref);
test_container<int, random_access_iterator_wrapper> c
- = {&v1[0], &v1[0] + size};
+ = {v1.data(), v1.data() + size};
test_range<int, random_access_iterator_wrapper> r
- = {&v2[0], &v2[0] + size};
+ = {v2.data(), v2.data() + size};
std::ranlux48_base g1(size), g2(size + 1);
ranges::shuffle(c, g1);
for (unsigned middle = 0; middle < 10; ++middle)
{
test_container<int, forward_iterator_wrapper> c
- = {&v1[0], &v1[0] + size};
+ = {v1.data(), v1.data() + size};
test_range<int, input_iterator_wrapper> r
- = {&v2[0], &v2[0] + size};
+ = {v2.data(), v2.data() + size};
std::vector<int> o1(middle), o2(middle);
test_range<int, random_access_iterator_wrapper> w1
- = {&o1[0], &o1[0]+middle};
+ = {o1.data(), o1.data()+middle};
test_range<int, random_access_iterator_wrapper> w2
- = {&o2[0], &o2[0]+middle};
+ = {o2.data(), o2.data()+middle};
auto [in1, out1] = ranges::partial_sort_copy(c.begin(), c.end(),
w1.begin(), w1.end(),
std::iota(vref.begin(), vref.end(), 0);
std::vector<int> v1(vref), v2(vref);
test_container<int, random_access_iterator_wrapper> c
- = {&v1[0], &v1[0] + size};
+ = {v1.data(), v1.data() + size};
test_range<int, random_access_iterator_wrapper> r
- = {&v2[0], &v2[0] + size};
+ = {v2.data(), v2.data() + size};
std::ranlux48_base g1(size), g2(size + 1);
VERIFY( ranges::shuffle(c, g1) == c.end() );
std::iota(vref.begin(), vref.end(), 0);
std::vector<int> v1(vref), v2(vref);
test_container<int, random_access_iterator_wrapper> c
- = {&v1[0], &v1[0] + size};
+ = {v1.data(), v1.data() + size};
test_range<int, random_access_iterator_wrapper> r
- = {&v2[0], &v2[0] + size};
+ = {v2.data(), v2.data() + size};
std::ranlux48_base g1(size), g2(size + 1);
ranges::shuffle(c, g1);
std::iota(vref.begin(), vref.end(), 0);
std::vector<int> v1(vref), v2(vref);
test_container<int, random_access_iterator_wrapper> c
- = {&v1[0], &v1[0] + size};
+ = {v1.data(), v1.data() + size};
test_range<int, random_access_iterator_wrapper> r
- = {&v2[0], &v2[0] + size};
+ = {v2.data(), v2.data() + size};
std::ranlux48_base g1(size), g2(size + 1);
ranges::shuffle(c, g1);