[llvm] [ADT] Add SmallVectorImpl::append_range (PR #93384)
Jakub Kuderski via llvm-commits
llvm-commits at lists.llvm.org
Sat May 25 19:25:13 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());
----------------
kuhar wrote:
We can't reuse the storage but we should be able to move the elements, no? E.g., skip allocations when appending a temporary range of `std::string`s. Maybe something based on `make_move_iterator` could work?
BTW, I think this should also use `adl_being`/`end`.
https://github.com/llvm/llvm-project/pull/93384
More information about the llvm-commits
mailing list