Before this commit, we'd get a compilation error because the operator() overload was ambiguous.
Details
Details
- Reviewers
- None
- Group Reviewers
Restricted Project - Commits
- rG98e4fd0701d0: [libcxx][ranges] Fix `ranges::empty` when begin, end, and empty members are…
Diff Detail
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Comment Actions
LGTM % test comments.
libcxx/test/std/ranges/range.access/range.prim/empty.pass.cpp | ||
---|---|---|
136–141 | As always, please unconstexpr and unbody the functions that aren't being called. This test has its advantages (all three functions have the same const-qualification so there's no best-match stuff to take into account) but I'd like to see additionally a test with the usual const-qualifications on getters: either struct BeginEndEmpty2 { int* begin(); int* end(); constexpr bool empty() const { return true; } }; or struct BeginEndEmpty2 { int* begin(); int* end(); const int* begin() const; const int* end() const; constexpr bool empty() const { return true; } }; which would have the advantage that you could test both std::ranges::empty(x) and std::ranges::empty(std::as_const(x)) — both should return the same result. |
As always, please unconstexpr and unbody the functions that aren't being called.
This test has its advantages (all three functions have the same const-qualification so there's no best-match stuff to take into account) but I'd like to see additionally a test with the usual const-qualifications on getters: either
or
which would have the advantage that you could test both std::ranges::empty(x) and std::ranges::empty(std::as_const(x)) — both should return the same result.