[libcxx-commits] [PATCH] D112631: [libc++][test] Fix invalid test for views::view_interface
Mark de Wever via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Oct 27 14:24:05 PDT 2021
Mordante added a comment.
In D112631#3091418 <https://reviews.llvm.org/D112631#3091418>, @cjdb wrote:
> There seems to be some confusion about whether or not this deviates from standard wording. It doesn't. I would very much prefer that our implementation catch user errors whenever we're in a position to do so, rather than let our users get false positives for a valid C++ program.
I agree we should catch it, but I dislike to change the public interface from the wording in the Standard. Hence my suggestion to add these additional constraints to the exposition only functions. IMO that's the better solution:
- The public interface follows the wording of the Standard.
- The additional constrains only need to be applied to two functions instead of all public functions.
So I prefer
_LIBCPP_HIDE_FROM_ABI
constexpr _Derived& __derived() noexcept requires view<D> && derived_from<D, view_interface<D>>
{
return static_cast<_Derived&>(*this);
}
over
template<class _D2 = _Derived>
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool empty()
noexcept(noexcept(__implicitly_convert_to<bool>(ranges::begin(__derived()) == ranges::end(__derived()))))
requires forward_range<_D2> && requires view<D> && derived_from<D, view_interface<D>>
{
return ranges::begin(__derived()) == ranges::end(__derived());
}
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D112631/new/
https://reviews.llvm.org/D112631
More information about the libcxx-commits
mailing list