[libcxx-commits] [libcxx] [libc++] Add [[nodiscard]] to std::prev and std::next (PR #109550)
via libcxx-commits
libcxx-commits at lists.llvm.org
Sat Sep 21 13:52:21 PDT 2024
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff e45fc5140df7bb60242a989ac7fc5cd0c0563234 eed6911ccd65e7a145d6d28ec933dec79390028c --extensions h -- libcxx/include/__iterator/next.h libcxx/include/__iterator/prev.h
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/libcxx/include/__iterator/next.h b/libcxx/include/__iterator/next.h
index 4064bcec4e..27b21e6f52 100644
--- a/libcxx/include/__iterator/next.h
+++ b/libcxx/include/__iterator/next.h
@@ -61,7 +61,8 @@ struct __next {
}
template <input_or_output_iterator _Ip, sentinel_for<_Ip> _Sp>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Ip operator()(_Ip __x, iter_difference_t<_Ip> __n, _Sp __bound_sentinel) const {
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Ip
+ operator()(_Ip __x, iter_difference_t<_Ip> __n, _Sp __bound_sentinel) const {
ranges::advance(__x, __n, __bound_sentinel);
return __x;
}
diff --git a/libcxx/include/__iterator/prev.h b/libcxx/include/__iterator/prev.h
index 0b88d33d92..6ee9f08308 100644
--- a/libcxx/include/__iterator/prev.h
+++ b/libcxx/include/__iterator/prev.h
@@ -54,7 +54,8 @@ struct __prev {
}
template <bidirectional_iterator _Ip>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Ip operator()(_Ip __x, iter_difference_t<_Ip> __n, _Ip __bound_iter) const {
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Ip
+ operator()(_Ip __x, iter_difference_t<_Ip> __n, _Ip __bound_iter) const {
ranges::advance(__x, -__n, __bound_iter);
return __x;
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/109550
More information about the libcxx-commits
mailing list