diff --git a/util/autovector.h b/util/autovector.h index b5c847124..97348d818 100644 --- a/util/autovector.h +++ b/util/autovector.h @@ -271,7 +271,12 @@ class autovector { template void emplace_back(Args&&... args) { - push_back(value_type(args...)); + if (num_stack_items_ < kSize) { + values_[num_stack_items_++] = + std::move(value_type(std::forward(args)...)); + } else { + vect_.emplace_back(std::forward(args)...); + } } void pop_back() {