[libcxx-commits] [PATCH] D138268: [libcxx] Fix std::equal not accepting volatile types by refactoring __equal_to
Nikolas Klauser via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Sat Nov 19 06:13:37 PST 2022
philnik accepted this revision.
philnik added a comment.
This revision is now accepted and ready to land.
LGTM with comments addressed and green CI.
================
Comment at: libcxx/test/std/algorithms/alg.nonmodifying/alg.equal/equal.pass.cpp:27
+template <class T1, class T2 = T1>
+void test_equal() {
----------------
We use `Iter1` and `Iter2` in newer tests to make clear what the type should be and I don't think we want to introduce other names for iterators, so please use these names instead.
================
Comment at: libcxx/test/std/algorithms/alg.nonmodifying/alg.equal/equal.pass.cpp:67
{
- int ia[] = {0, 1, 2, 3, 4, 5};
- const unsigned s = sizeof(ia)/sizeof(ia[0]);
- int ib[s] = {0, 1, 2, 5, 4, 5};
- assert(std::equal(cpp17_input_iterator<const int*>(ia),
- cpp17_input_iterator<const int*>(ia+s),
- cpp17_input_iterator<const int*>(ia)));
+ test_equal<cpp17_input_iterator<const int*>>();
+
----------------
To make it work in C++03.
================
Comment at: libcxx/test/std/algorithms/alg.nonmodifying/alg.equal/equal.pass.cpp:69
+
#if TEST_STD_VER >= 14
+ test_equal<random_access_iterator<const int*>>();
----------------
I don't think we have to guard this. It doesn't hurt to test it in all versions.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D138268/new/
https://reviews.llvm.org/D138268
More information about the libcxx-commits
mailing list