[llvm] [WIP][ADT] Avoid slow size queries on append (PR #136365)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 18 13:38:00 PDT 2025


================
@@ -887,8 +921,8 @@ class SmallVectorImpl : public SmallVectorTemplateBase<T> {
     this->assertSafeToAddRange(From, To);
 
     size_t NumToInsert = std::distance(From, To);
----------------
kazutakahirata wrote:

Are you going to address this call to `std::distance`?  If we have an input iterator that is not a forward iterator, then we would be iterating the range twice.

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


More information about the llvm-commits mailing list