[libcxx-commits] [libcxx] [libc++] Refactor vector move constructor with allocator (PR #116449)
Peng Liu via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Nov 15 19:47:11 PST 2024
https://github.com/winner245 updated https://github.com/llvm/llvm-project/pull/116449
>From 85b11699c914990e0aea68e2ea8f3f9e695a427f Mon Sep 17 00:00:00 2001
From: Peng Liu <winner245 at hotmail.com>
Date: Fri, 15 Nov 2024 18:00:12 -0500
Subject: [PATCH] Refactor vector move-ctor with allocator
---
libcxx/include/__vector/vector.h | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/libcxx/include/__vector/vector.h b/libcxx/include/__vector/vector.h
index d2d707d8c913c0..ac07750d8ece2f 100644
--- a/libcxx/include/__vector/vector.h
+++ b/libcxx/include/__vector/vector.h
@@ -976,9 +976,7 @@ vector<_Tp, _Allocator>::vector(vector&& __x, const __type_identity_t<allocator_
__x.__begin_ = __x.__end_ = __x.__end_cap() = nullptr;
} else {
typedef move_iterator<iterator> _Ip;
- auto __guard = std::__make_exception_guard(__destroy_vector(*this));
- assign(_Ip(__x.begin()), _Ip(__x.end()));
- __guard.__complete();
+ __init_with_size(_Ip(__x.begin()), _Ip(__x.end()), __x.size());
}
}
More information about the libcxx-commits
mailing list