[libcxx-commits] [libcxx] [libc++] Simplify most of the segemented iterator optimizations (PR #164797)

via libcxx-commits libcxx-commits at lists.llvm.org
Thu Oct 23 06:25:27 PDT 2025


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 origin/main HEAD --extensions h -- libcxx/include/__algorithm/fill.h libcxx/include/__algorithm/fill_n.h libcxx/include/__algorithm/for_each.h libcxx/include/__algorithm/for_each_n.h libcxx/include/__iterator/distance.h libcxx/include/__iterator/segmented_iterator.h --diff_from_common_commit
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/libcxx/include/__iterator/distance.h b/libcxx/include/__iterator/distance.h
index 763adafc1..dbc22d335 100644
--- a/libcxx/include/__iterator/distance.h
+++ b/libcxx/include/__iterator/distance.h
@@ -48,8 +48,8 @@ __distance(_RandIter __first, _RandIter __last) {
 }
 
 template <class _InputIter, class _Sent>
-inline _LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR_SINCE_CXX17 __iter_distance_t<_InputIter> __distance(_InputIter __first, _Sent __last) {
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 __iter_distance_t<_InputIter>
+__distance(_InputIter __first, _Sent __last) {
   __iter_distance_t<_InputIter> __r(0);
 #if _LIBCPP_STD_VER >= 20
   if constexpr (same_as<_InputIter, _Sent> && __is_segmented_iterator_v<_InputIter>) {

``````````

</details>


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


More information about the libcxx-commits mailing list