[libcxx-commits] [PATCH] D101737: [libcxx] Implement view.interface.

Casey Carter via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue Jun 1 06:56:06 PDT 2021


CaseyCarter added inline comments.


================
Comment at: libcxx/include/__ranges/view_interface.h:49
+  [[nodiscard]] constexpr bool empty()
+    noexcept(noexcept(ranges::begin(__derived()) == ranges::end(__derived())))
+    requires forward_range<_D2>
----------------
You're missing that the implicit conversion to of this expression to `bool` could be potentially throwing. We use something like:
```c++
template <class T>
void implicit_convert_to(type_identity_t<T>) noexcept;
/* ... */
  noexcept(noexcept(implicit_convert_to<bool>(ranges::begin(__derived()) == ranges::end(__derived()))))
```


================
Comment at: libcxx/include/__ranges/view_interface.h:55
+
+  template<class _D2 = _Derived>
+  [[nodiscard]] constexpr bool empty() const
----------------
ldionne wrote:
> Why is that necessary? Is that the workaround for `gcc -fconcepts` you're discussing in the comments below?
This is necessary to workaround https://bugs.llvm.org/show_bug.cgi?id=44833.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101737



More information about the libcxx-commits mailing list