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

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


================
@@ -80,7 +80,8 @@ class __wrap_iter {
     --(*this);
     return __tmp;
   }
-  _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __wrap_iter operator+(difference_type __n) const _NOEXCEPT {
+  [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __wrap_iter
+  operator+(difference_type __n) const _NOEXCEPT {
----------------
frederick-vs-ja wrote:

Actually, most such "private iterators" are available to users as containers' iterators. Let's add `[[__nodiscard__]]` and test them together with containers.

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


More information about the libcxx-commits mailing list