[libcxx-commits] [PATCH] D102006: [libcxx][ranges] Add range.subrange.

Mark de Wever via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed Jun 2 10:14:02 PDT 2021


Mordante added inline comments.


================
Comment at: libcxx/include/__ranges/subrange.h:159
+
+    [[nodiscard]] constexpr bool empty() const { return __begin == __end; }
+
----------------
zoecarver wrote:
> Mordante wrote:
> > This one shouldn't be `[[nodiscard]]` according to the Standard.
> I think we decided that members named "empty" are sufficiently vexing because users something think it will empty the container (or in this case sub range). 
Oke wasn't aware we decided that. But I agree calling `size()` and discarding the result is most likely a bug.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D102006



More information about the libcxx-commits mailing list