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

Zoe Carver via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue May 11 11:08:58 PDT 2021


zoecarver added inline comments.


================
Comment at: libcxx/include/__ranges/view_interface.h:117
+  template<class _D2 = _Derived>
+  [[nodiscard]] constexpr auto size() const
+    noexcept(noexcept(ranges::end(__derived()) - ranges::begin(__derived())))
----------------
cjdb wrote:
> Quuxplusone wrote:
> > zoecarver wrote:
> > > Remove all the nodiscards except for empty. 
> > It would be appropriate to mark them `_LIBCPP_NODISCARD_EXT` (with tests).
> > Remove all the nodiscards except for empty.
> 
> Please elaborate.
> 
> > It would be appropriate to mark them `_LIBCPP_NODISCARD_EXT` (with tests).
> 
> Why is this different to `[[nodiscard]]` + disabling the warning?
> Please elaborate.

We've discussed elsewhere, I think libc++ is only going to apply nodiscard to methods where a user might think that a side effect is happening (such as `.empty()`). 


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