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

Hristo Hristov via libcxx-commits libcxx-commits at lists.llvm.org
Tue Feb 24 04:32:30 PST 2026


================
@@ -207,18 +214,18 @@ class __wrap_iter {
 
 #ifndef _LIBCPP_CXX03_LANG
   template <class _Iter2>
-  _LIBCPP_HIDE_FROM_ABI friend _LIBCPP_CONSTEXPR_SINCE_CXX14 auto
+  [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI friend _LIBCPP_CONSTEXPR_SINCE_CXX14 auto
   operator-(const __wrap_iter& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT->decltype(__x.base() - __y.base())
 #else
   template <class _Iter2>
-  _LIBCPP_HIDE_FROM_ABI friend _LIBCPP_CONSTEXPR_SINCE_CXX14
+  [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI friend _LIBCPP_CONSTEXPR_SINCE_CXX14
   typename __wrap_iter::difference_type operator-(const __wrap_iter& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT
 #endif // C++03
   {
     return __x.base() - __y.base();
   }
 
-  _LIBCPP_HIDE_FROM_ABI friend _LIBCPP_CONSTEXPR_SINCE_CXX14 __wrap_iter
+  [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI friend _LIBCPP_CONSTEXPR_SINCE_CXX14 __wrap_iter
   operator+(typename __wrap_iter::difference_type __n, __wrap_iter __x) _NOEXCEPT {
     __x += __n;
     return __x;
----------------
H-G-Hristov wrote:

@smallp-o-p Please review if your changes are intact after merging with: https://github.com/llvm/llvm-project/pull/179590

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


More information about the libcxx-commits mailing list