[libcxx-commits] [PATCH] D131395: [libc++] Implement `lexicographical_compare_three_way`
Adrian Vogelsgesang via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Aug 16 13:42:52 PDT 2022
avogelsgesang added inline comments.
================
Comment at: libcxx/test/std/algorithms/alg.sorting/alg.three.way/lexicographical_compare_three_way.pass.cpp:110-118
+ // Both iterator types are random access iterators -> triggers a special fast path inside `lexicographical_compare_three_way`
+ test_iterator_types<const int*, const int*>();
+ test_iterator_types<contiguous_iterator<const int*>, cpp20_random_access_iterator<const int*>>();
+ // One of the two iterator types is not a random access iterator -> fallback to slower algorithm
+ test_iterator_types<const int*, forward_iterator<const int*>>();
+ test_iterator_types<forward_iterator<const int*>, const int*>();
+ // Check with various other iterator types
----------------
philnik wrote:
> Please check the complete cartesian product of `cpp17_input_iterator`, `forward_iterator`, `bidirectional_iterator`, `random_access_iterator`, `contiguous_iterator`, `const int*` and `int*`. Also, `cpp20_random_access_iterator` is just a C++17 input iterator.
done, except for `int*`. `int*` does not work, because the currently used `array`s are const.
Is it fine not to test `int*`? Which additional test coverage would `int*` give us over `const int*`?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D131395/new/
https://reviews.llvm.org/D131395
More information about the libcxx-commits
mailing list