[libcxx-commits] [libcxx] [libc++][iterator] Applied `[[nodiscard]]` (PR #172200)

A. Jiang via libcxx-commits libcxx-commits at lists.llvm.org
Tue Dec 23 00:57:46 PST 2025


================
@@ -80,9 +80,9 @@ class __iterator_with_data {
     return __tmp;
   }
 
-  constexpr _LIBCPP_HIDE_FROM_ABI iter_reference_t<_Iterator> operator*() const { return *__iter_; }
+  [[nodiscard]] constexpr _LIBCPP_HIDE_FROM_ABI iter_reference_t<_Iterator> operator*() const { return *__iter_; }
----------------
frederick-vs-ja wrote:

`__iterator_with_data` is the only exception in the `__iterator` directory, IIUC. It's only used for optimizations for `join_view`'s iterator.
If there's no public way to test its `operator*` and `iter_move`, perhaps it would be OK to drop `[[nodiscard]]`.

https://github.com/llvm/llvm-project/pull/172200


More information about the libcxx-commits mailing list