[libcxx-commits] [libcxx] [libc++][ranges] LWG3715: `view_interface::empty` is overconstrained (PR #85004)
Hristo Hristov via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Mar 14 00:34:24 PDT 2024
================
@@ -51,16 +52,24 @@ class view_interface {
public:
template <class _D2 = _Derived>
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool empty()
- requires forward_range<_D2>
+ requires sized_range<_D2> || forward_range<_D2>
{
- return ranges::begin(__derived()) == ranges::end(__derived());
+ if constexpr (sized_range<_D2>) {
+ return ranges::size(__derived()) == 0;
----------------
Zingam wrote:
I haven't done a full review. Do we have a test case for the new return code path with a sized_range? Please add one here and for the case bellow if needed. Please wait for a code owner to do the final review and to approve. Thank you for working on this.
https://github.com/llvm/llvm-project/pull/85004
More information about the libcxx-commits
mailing list