[libcxx-commits] [PATCH] D150831: [libc++] Implement ranges::ends_with
Zijun Zhao via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Jun 22 14:41:10 PDT 2023
ZijunZhao added inline comments.
================
Comment at: libcxx/test/std/algorithms/alg.nonmodifying/alg.ends_with/ranges.ends_with.pass.cpp:63
+template <class Iter1, class Sent1 = Iter1, class Iter2, class Sent2 = Iter2>
+constexpr void test_iterators() {
+ { // simple tests
----------------
var-const wrote:
> We need to also add one test to check the return type, something like:
> ```
> { // Check the return type
> int a[] = {1, 2, 3, 4, 5, 6};
> int p[] = {5, 6};
> auto whole = std::ranges::subrange(Iter1(a), Sent1(Iter1(a + 6)));
> auto suffix = std::ranges::subrange(Iter2(p), Sent2(Iter2(p + 2)));
>
> {
> [[maybe_unused]] std::same_as<bool> decltype(auto) ret = std::ranges::ends_with(whole.begin(), whole.end(), suffix.begin(), suffix.end());
> }
> {
> [[maybe_unused]] std::same_as<bool> decltype(auto) ret = std::ranges::ends_with(whole, suffix);
> }
> }
> ```
>
okay I think the simple test is duplicated so I will make the simple test to check and use `std::same_as<bool>`
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D150831/new/
https://reviews.llvm.org/D150831
More information about the libcxx-commits
mailing list