[libcxx-commits] [PATCH] D115838: [libc++] [ranges] Remove the static_assert from ranges::begin and ranges::end.

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Fri Dec 17 07:33:33 PST 2021


ldionne requested changes to this revision.
ldionne added a comment.
This revision now requires changes to proceed.

I would have expected a test for SFINAE-friendliness of `ranges::data` on incomplete array types, but http://eel.is/c++draft/range.access#range.prim.data-2.2 says it's IFNDR. These inconsistencies in the spec are somewhat concerning.



================
Comment at: libcxx/include/__ranges/access.h:65
+      requires is_array_v<remove_cv_t<_Tp>>
+    [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp& __t) const noexcept
+    {
----------------
Could we add another overload like this:

```
template <class _Tp>
      requires is_array_v<remove_cv_t<_Tp>> && !__is_complete<iter_value_t<_Tp>>
void operator()(_Tp&&) = delete;
```

of something of that sort? Otherwise, why don't we simply add the constraint `__is_complete` to this overload?


================
Comment at: libcxx/include/__ranges/access.h:126
+    [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp (&__t)[_Np]) const noexcept
+      requires (sizeof(*__t) != 0)
+    {
----------------
Why not use `__is_complete`? The name conveys more information than this expression IMO.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D115838/new/

https://reviews.llvm.org/D115838



More information about the libcxx-commits mailing list