[libcxx-commits] [libcxx] [libc++] Fix assignment in insertion into `vector` (PR #116001)

via libcxx-commits libcxx-commits at lists.llvm.org
Tue Feb 18 02:53:26 PST 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 c71f9141a970b6f6d46d27d7c26c7747dd525275 902653c55c9242ac2d634e9bded0cd3ead53a827 --extensions cpp,h -- libcxx/include/__vector/vector.h libcxx/test/std/containers/sequences/vector/vector.modifiers/insert_iter_iter_iter.pass.cpp libcxx/test/std/containers/sequences/vector/vector.modifiers/insert_range.pass.cpp
``````````

</details>

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

``````````diff
diff --git a/libcxx/test/std/containers/sequences/vector/vector.modifiers/insert_iter_iter_iter.pass.cpp b/libcxx/test/std/containers/sequences/vector/vector.modifiers/insert_iter_iter_iter.pass.cpp
index 34b13a5c7d..efd553c4e9 100644
--- a/libcxx/test/std/containers/sequences/vector/vector.modifiers/insert_iter_iter_iter.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector/vector.modifiers/insert_iter_iter_iter.pass.cpp
@@ -161,24 +161,24 @@ TEST_CONSTEXPR_CXX20 bool tests() {
     for (; j < 105; ++j)
       assert(v[j] == 0);
   }
-    {
-      struct Wrapper {
-        TEST_CONSTEXPR Wrapper(int n) : n_(n) {}
+  {
+    struct Wrapper {
+      TEST_CONSTEXPR Wrapper(int n) : n_(n) {}
 
-        int n_;
+      int n_;
 
-      private:
-        void operator=(int);
-      };
+    private:
+      void operator=(int);
+    };
 
-      int a[]                 = {1, 2, 3, 4, 5};
-      const std::size_t count = sizeof(a) / sizeof(a[0]);
-      std::vector<Wrapper> v;
-      v.insert(v.end(), a, a + count);
-      assert(v.size() == count);
-      for (std::size_t i = 0; i != count; ++i)
-        assert(v[i].n_ == a[i]);
-    }
+    int a[]                 = {1, 2, 3, 4, 5};
+    const std::size_t count = sizeof(a) / sizeof(a[0]);
+    std::vector<Wrapper> v;
+    v.insert(v.end(), a, a + count);
+    assert(v.size() == count);
+    for (std::size_t i = 0; i != count; ++i)
+      assert(v[i].n_ == a[i]);
+  }
 #if TEST_STD_VER >= 11
   {
     typedef std::vector<int, min_allocator<int> > V;

``````````

</details>


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


More information about the libcxx-commits mailing list