[libcxx-commits] [libcxx] Optimize __insert_with_sentinel Function in std::vector (PR #113768)

via libcxx-commits libcxx-commits at lists.llvm.org
Thu Nov 7 14:14:32 PST 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 7475156d49406785a974b1205d11fe3de9c1553e a31c874374982a268657fa3126a2343f7dcf4944 --extensions h,cpp -- libcxx/include/__vector/vector.h libcxx/test/benchmarks/ContainerBenchmarks.h libcxx/test/benchmarks/GenerateInput.h libcxx/test/benchmarks/vector_operations.bench.cpp libcxx/test/std/containers/sequences/vector/vector.modifiers/insert_iter_iter_iter.pass.cpp
``````````

</details>

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

``````````diff
diff --git a/libcxx/include/__vector/vector.h b/libcxx/include/__vector/vector.h
index bc739efc72..38d5f9305d 100644
--- a/libcxx/include/__vector/vector.h
+++ b/libcxx/include/__vector/vector.h
@@ -1285,8 +1285,8 @@ vector<_Tp, _Allocator>::__insert_with_sentinel(const_iterator __position, _Inpu
     std::__uninitialized_allocator_relocate(
         __a, std::__to_address(__v.__begin_), std::__to_address(__v.__end_), std::__to_address(__merged.__end_));
     __merged.__end_ += __v.size();
-    __v.__end_   = __v.__begin_;
-    __p          = __swap_out_circular_buffer(__merged, __p);
+    __v.__end_ = __v.__begin_;
+    __p        = __swap_out_circular_buffer(__merged, __p);
   }
   return __make_iter(__p);
 }

``````````

</details>


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


More information about the libcxx-commits mailing list