Parcourir la source

Simplify capacity growth calculation.

Mark D. Roth il y a 7 ans
Parent
commit
5885b53809
1 fichiers modifiés avec 1 ajouts et 2 suppressions
  1. 1 2
      src/core/lib/gprpp/inlined_vector.h

+ 1 - 2
src/core/lib/gprpp/inlined_vector.h

@@ -88,8 +88,7 @@ class InlinedVector {
   template <typename... Args>
   void emplace_back(Args&&... args) {
     if (size_ == capacity_) {
-      const size_t new_capacity = capacity_ == 0 ? 2 : capacity_ * 2;
-      reserve(new_capacity);
+      reserve(capacity_ * 2);
     }
     new (&(data()[size_])) T(std::forward<Args>(args)...);
     ++size_;