diff --git a/folly/small_vector.h b/folly/small_vector.h index fcb2de64e4f..9c6ff739242 100644 --- a/folly/small_vector.h +++ b/folly/small_vector.h @@ -551,8 +551,11 @@ class small_vector this->u.setCapacity(o.u.getCapacity()); } } else { - if (kShouldCopyInlineTrivial) { - copyInlineTrivial(o); + if constexpr (IsRelocatable::value) { + // Copy the entire inline storage, instead of just size() values, to + // make the loop fixed-size and unrollable. + std::memcpy(u.buffer(), o.u.buffer(), MaxInline * kSizeOfValue); + this->setSize(o.size()); o.resetSizePolicy(); } else { auto n = o.size();