[llvm] [ADT] Add SmallVectorImpl::append_range (PR #93384)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Sat May 25 15:12:52 PDT 2024


================
@@ -701,6 +701,10 @@ class SmallVectorImpl : public SmallVectorTemplateBase<T> {
     this->set_size(this->size() + NumInputs);
   }
 
+  template <typename RangeTy> void append_range(RangeTy &&R) {
+    this->append(R.begin(), R.end());
----------------
kazutakahirata wrote:

I don't think this will move elements.  It should copy elements because we cannot reuse the storage used by the container that the given range is pointing to.

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


More information about the llvm-commits mailing list