about summary refs log tree commit diff
path: root/absl/container/internal/inlined_vector.h
diff options
context:
space:
mode:
Diffstat (limited to 'absl/container/internal/inlined_vector.h')
-rw-r--r--absl/container/internal/inlined_vector.h16
1 files changed, 5 insertions, 11 deletions
diff --git a/absl/container/internal/inlined_vector.h b/absl/container/internal/inlined_vector.h
index a84b5255a82e..c2802c823a8d 100644
--- a/absl/container/internal/inlined_vector.h
+++ b/absl/container/internal/inlined_vector.h
@@ -275,7 +275,11 @@ class Storage {
   explicit Storage(const allocator_type& alloc)
       : metadata_(alloc, /* empty and inlined */ 0) {}
 
-  ~Storage() { DestroyAndDeallocate(); }
+  ~Storage() {
+    pointer data = GetIsAllocated() ? GetAllocatedData() : GetInlinedData();
+    inlined_vector_internal::DestroyElements(GetAllocPtr(), data, GetSize());
+    DeallocateIfAllocated();
+  }
 
   size_type GetSize() const { return GetSizeAndIsAllocated() >> 1; }
 
@@ -377,8 +381,6 @@ class Storage {
     data_ = other_storage.data_;
   }
 
-  void DestroyAndDeallocate();
-
   template <typename ValueAdapter>
   void Initialize(ValueAdapter values, size_type new_size);
 
@@ -433,14 +435,6 @@ class Storage {
 };
 
 template <typename T, size_t N, typename A>
-void Storage<T, N, A>::DestroyAndDeallocate() {
-  inlined_vector_internal::DestroyElements(
-      GetAllocPtr(), (GetIsAllocated() ? GetAllocatedData() : GetInlinedData()),
-      GetSize());
-  DeallocateIfAllocated();
-}
-
-template <typename T, size_t N, typename A>
 template <typename ValueAdapter>
 auto Storage<T, N, A>::Initialize(ValueAdapter values, size_type new_size)
     -> void {