abseil-cpp/absl/container/internal/inlined_vector.h
Go to the documentation of this file.
1 // Copyright 2019 The Abseil Authors.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // https://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #ifndef ABSL_CONTAINER_INTERNAL_INLINED_VECTOR_INTERNAL_H_
16 #define ABSL_CONTAINER_INTERNAL_INLINED_VECTOR_INTERNAL_H_
17 
18 #include <algorithm>
19 #include <cstddef>
20 #include <cstring>
21 #include <iterator>
22 #include <limits>
23 #include <memory>
24 #include <new>
25 #include <type_traits>
26 #include <utility>
27 
28 #include "absl/base/attributes.h"
29 #include "absl/base/macros.h"
30 #include "absl/container/internal/compressed_tuple.h"
31 #include "absl/memory/memory.h"
32 #include "absl/meta/type_traits.h"
33 #include "absl/types/span.h"
34 
35 namespace absl {
37 namespace inlined_vector_internal {
38 
39 // GCC does not deal very well with the below code
40 #if !defined(__clang__) && defined(__GNUC__)
41 #pragma GCC diagnostic push
42 #pragma GCC diagnostic ignored "-Warray-bounds"
43 #endif
44 
45 template <typename A>
46 using AllocatorTraits = std::allocator_traits<A>;
47 template <typename A>
49 template <typename A>
51 template <typename A>
53 template <typename A>
55 template <typename A>
57 template <typename A>
59 template <typename A>
61 template <typename A>
63 template <typename A>
65 template <typename A>
67 template <typename A>
68 using ReverseIterator = typename std::reverse_iterator<Iterator<A>>;
69 template <typename A>
70 using ConstReverseIterator = typename std::reverse_iterator<ConstIterator<A>>;
71 template <typename A>
72 using MoveIterator = typename std::move_iterator<Iterator<A>>;
73 
74 template <typename Iterator>
75 using IsAtLeastForwardIterator = std::is_convertible<
76  typename std::iterator_traits<Iterator>::iterator_category,
77  std::forward_iterator_tag>;
78 
79 template <typename A>
80 using IsMemcpyOk =
85 
86 template <typename T>
87 struct TypeIdentity {
88  using type = T;
89 };
90 
91 // Used for function arguments in template functions to prevent ADL by forcing
92 // callers to explicitly specify the template parameter.
93 template <typename T>
95 
96 template <typename A, bool IsTriviallyDestructible =
99 
100 template <typename A>
101 struct DestroyAdapter<A, /* IsTriviallyDestructible */ false> {
102  static void DestroyElements(A& allocator, Pointer<A> destroy_first,
103  SizeType<A> destroy_size) {
104  for (SizeType<A> i = destroy_size; i != 0;) {
105  --i;
106  AllocatorTraits<A>::destroy(allocator, destroy_first + i);
107  }
108  }
109 };
110 
111 template <typename A>
112 struct DestroyAdapter<A, /* IsTriviallyDestructible */ true> {
113  static void DestroyElements(A& allocator, Pointer<A> destroy_first,
114  SizeType<A> destroy_size) {
115  static_cast<void>(allocator);
116  static_cast<void>(destroy_first);
117  static_cast<void>(destroy_size);
118  }
119 };
120 
121 template <typename A>
122 struct Allocation {
125 };
126 
127 template <typename A,
128  bool IsOverAligned =
131  static Allocation<A> Allocate(A& allocator, SizeType<A> requested_capacity) {
132  return {AllocatorTraits<A>::allocate(allocator, requested_capacity),
133  requested_capacity};
134  }
135 
136  static void Deallocate(A& allocator, Pointer<A> pointer,
138  AllocatorTraits<A>::deallocate(allocator, pointer, capacity);
139  }
140 };
141 
142 template <typename A, typename ValueAdapter>
144  Pointer<A> construct_first, ValueAdapter& values,
145  SizeType<A> construct_size) {
146  for (SizeType<A> i = 0; i < construct_size; ++i) {
147  ABSL_INTERNAL_TRY { values.ConstructNext(allocator, construct_first + i); }
149  DestroyAdapter<A>::DestroyElements(allocator, construct_first, i);
151  }
152  }
153 }
154 
155 template <typename A, typename ValueAdapter>
156 void AssignElements(Pointer<A> assign_first, ValueAdapter& values,
157  SizeType<A> assign_size) {
158  for (SizeType<A> i = 0; i < assign_size; ++i) {
159  values.AssignNext(assign_first + i);
160  }
161 }
162 
163 template <typename A>
164 struct StorageView {
168 };
169 
170 template <typename A, typename Iterator>
172  public:
173  explicit IteratorValueAdapter(const Iterator& it) : it_(it) {}
174 
175  void ConstructNext(A& allocator, Pointer<A> construct_at) {
176  AllocatorTraits<A>::construct(allocator, construct_at, *it_);
177  ++it_;
178  }
179 
180  void AssignNext(Pointer<A> assign_at) {
181  *assign_at = *it_;
182  ++it_;
183  }
184 
185  private:
187 };
188 
189 template <typename A>
191  public:
193 
194  void ConstructNext(A& allocator, Pointer<A> construct_at) {
195  AllocatorTraits<A>::construct(allocator, construct_at, *ptr_);
196  }
197 
198  void AssignNext(Pointer<A> assign_at) { *assign_at = *ptr_; }
199 
200  private:
202 };
203 
204 template <typename A>
206  public:
207  explicit DefaultValueAdapter() {}
208 
209  void ConstructNext(A& allocator, Pointer<A> construct_at) {
210  AllocatorTraits<A>::construct(allocator, construct_at);
211  }
212 
213  void AssignNext(Pointer<A> assign_at) { *assign_at = ValueType<A>(); }
214 };
215 
216 template <typename A>
218  public:
219  explicit AllocationTransaction(A& allocator)
220  : allocator_data_(allocator, nullptr), capacity_(0) {}
221 
223  if (DidAllocate()) {
225  }
226  }
227 
229  void operator=(const AllocationTransaction&) = delete;
230 
231  A& GetAllocator() { return allocator_data_.template get<0>(); }
232  Pointer<A>& GetData() { return allocator_data_.template get<1>(); }
234 
235  bool DidAllocate() { return GetData() != nullptr; }
236 
237  Pointer<A> Allocate(SizeType<A> requested_capacity) {
239  MallocAdapter<A>::Allocate(GetAllocator(), requested_capacity);
240  GetData() = result.data;
241  GetCapacity() = result.capacity;
242  return result.data;
243  }
244 
247  Reset();
248  return result;
249  }
250 
251  private:
252  void Reset() {
253  GetData() = nullptr;
254  GetCapacity() = 0;
255  }
256 
259 };
260 
261 template <typename A>
263  public:
264  explicit ConstructionTransaction(A& allocator)
265  : allocator_data_(allocator, nullptr), size_(0) {}
266 
268  if (DidConstruct()) {
270  }
271  }
272 
274  void operator=(const ConstructionTransaction&) = delete;
275 
276  A& GetAllocator() { return allocator_data_.template get<0>(); }
277  Pointer<A>& GetData() { return allocator_data_.template get<1>(); }
278  SizeType<A>& GetSize() { return size_; }
279 
280  bool DidConstruct() { return GetData() != nullptr; }
281  template <typename ValueAdapter>
282  void Construct(Pointer<A> data, ValueAdapter& values, SizeType<A> size) {
283  ConstructElements<A>(GetAllocator(), data, values, size);
284  GetData() = data;
285  GetSize() = size;
286  }
287  void Commit() && {
288  GetData() = nullptr;
289  GetSize() = 0;
290  }
291 
292  private:
295 };
296 
297 template <typename T, size_t N, typename A>
298 class Storage {
299  public:
300  static SizeType<A> NextCapacity(SizeType<A> current_capacity) {
301  return current_capacity * 2;
302  }
303 
304  static SizeType<A> ComputeCapacity(SizeType<A> current_capacity,
305  SizeType<A> requested_capacity) {
306  return (std::max)(NextCapacity(current_capacity), requested_capacity);
307  }
308 
309  // ---------------------------------------------------------------------------
310  // Storage Constructors and Destructor
311  // ---------------------------------------------------------------------------
312 
313  Storage() : metadata_(A(), /* size and is_allocated */ 0u) {}
314 
315  explicit Storage(const A& allocator)
316  : metadata_(allocator, /* size and is_allocated */ 0u) {}
317 
319  if (GetSizeAndIsAllocated() == 0) {
320  // Empty and not allocated; nothing to do.
321  } else if (IsMemcpyOk<A>::value) {
322  // No destructors need to be run; just deallocate if necessary.
324  } else {
325  DestroyContents();
326  }
327  }
328 
329  // ---------------------------------------------------------------------------
330  // Storage Member Accessors
331  // ---------------------------------------------------------------------------
332 
333  SizeType<A>& GetSizeAndIsAllocated() { return metadata_.template get<1>(); }
334 
336  return metadata_.template get<1>();
337  }
338 
339  SizeType<A> GetSize() const { return GetSizeAndIsAllocated() >> 1; }
340 
341  bool GetIsAllocated() const { return GetSizeAndIsAllocated() & 1; }
342 
344 
347  }
348 
350  return reinterpret_cast<Pointer<A>>(
351  std::addressof(data_.inlined.inlined_data[0]));
352  }
353 
355  return reinterpret_cast<ConstPointer<A>>(
356  std::addressof(data_.inlined.inlined_data[0]));
357  }
358 
361  }
362 
363  SizeType<A> GetInlinedCapacity() const { return static_cast<SizeType<A>>(N); }
364 
370  }
371 
372  A& GetAllocator() { return metadata_.template get<0>(); }
373 
374  const A& GetAllocator() const { return metadata_.template get<0>(); }
375 
376  // ---------------------------------------------------------------------------
377  // Storage Member Mutators
378  // ---------------------------------------------------------------------------
379 
380  ABSL_ATTRIBUTE_NOINLINE void InitFrom(const Storage& other);
381 
382  template <typename ValueAdapter>
383  void Initialize(ValueAdapter values, SizeType<A> new_size);
384 
385  template <typename ValueAdapter>
386  void Assign(ValueAdapter values, SizeType<A> new_size);
387 
388  template <typename ValueAdapter>
389  void Resize(ValueAdapter values, SizeType<A> new_size);
390 
391  template <typename ValueAdapter>
393  SizeType<A> insert_count);
394 
395  template <typename... Args>
397 
399 
400  void Reserve(SizeType<A> requested_capacity);
401 
402  void ShrinkToFit();
403 
404  void Swap(Storage* other_storage_ptr);
405 
406  void SetIsAllocated() {
407  GetSizeAndIsAllocated() |= static_cast<SizeType<A>>(1);
408  }
409 
411  GetSizeAndIsAllocated() &= ((std::numeric_limits<SizeType<A>>::max)() - 1);
412  }
413 
417  }
418 
421  }
422 
425  }
426 
428  GetSizeAndIsAllocated() += count << static_cast<SizeType<A>>(1);
429  }
430 
433 
434  GetSizeAndIsAllocated() -= count << static_cast<SizeType<A>>(1);
435  }
436 
437  void SetAllocation(Allocation<A> allocation) {
438  data_.allocated.allocated_data = allocation.data;
440  }
441 
442  void MemcpyFrom(const Storage& other_storage) {
444  other_storage.GetIsAllocated());
445 
446  GetSizeAndIsAllocated() = other_storage.GetSizeAndIsAllocated();
447  data_ = other_storage.data_;
448  }
449 
451  if (GetIsAllocated()) {
454  }
455  }
456 
457  private:
459 
461 
462  struct Allocated {
465  };
466 
467  struct Inlined {
468  alignas(ValueType<A>) char inlined_data[sizeof(ValueType<A>[N])];
469  };
470 
471  union Data {
474  };
475 
476  template <typename... Args>
478 
480  Data data_;
481 };
482 
483 template <typename T, size_t N, typename A>
485  Pointer<A> data = GetIsAllocated() ? GetAllocatedData() : GetInlinedData();
486  DestroyAdapter<A>::DestroyElements(GetAllocator(), data, GetSize());
487  DeallocateIfAllocated();
488 }
489 
490 template <typename T, size_t N, typename A>
492  const SizeType<A> n = other.GetSize();
493  ABSL_HARDENING_ASSERT(n > 0); // Empty sources handled handled in caller.
494  ConstPointer<A> src;
495  Pointer<A> dst;
496  if (!other.GetIsAllocated()) {
497  dst = GetInlinedData();
498  src = other.GetInlinedData();
499  } else {
500  // Because this is only called from the `InlinedVector` constructors, it's
501  // safe to take on the allocation with size `0`. If `ConstructElements(...)`
502  // throws, deallocation will be automatically handled by `~Storage()`.
503  SizeType<A> requested_capacity = ComputeCapacity(GetInlinedCapacity(), n);
504  Allocation<A> allocation =
505  MallocAdapter<A>::Allocate(GetAllocator(), requested_capacity);
506  SetAllocation(allocation);
507  dst = allocation.data;
508  src = other.GetAllocatedData();
509  }
510  if (IsMemcpyOk<A>::value) {
511  std::memcpy(reinterpret_cast<char*>(dst),
512  reinterpret_cast<const char*>(src), n * sizeof(ValueType<A>));
513  } else {
515  ConstructElements<A>(GetAllocator(), dst, values, n);
516  }
517  GetSizeAndIsAllocated() = other.GetSizeAndIsAllocated();
518 }
519 
520 template <typename T, size_t N, typename A>
521 template <typename ValueAdapter>
523  -> void {
524  // Only callable from constructors!
525  ABSL_HARDENING_ASSERT(!GetIsAllocated());
526  ABSL_HARDENING_ASSERT(GetSize() == 0);
527 
528  Pointer<A> construct_data;
529  if (new_size > GetInlinedCapacity()) {
530  // Because this is only called from the `InlinedVector` constructors, it's
531  // safe to take on the allocation with size `0`. If `ConstructElements(...)`
532  // throws, deallocation will be automatically handled by `~Storage()`.
533  SizeType<A> requested_capacity =
534  ComputeCapacity(GetInlinedCapacity(), new_size);
535  Allocation<A> allocation =
536  MallocAdapter<A>::Allocate(GetAllocator(), requested_capacity);
537  construct_data = allocation.data;
538  SetAllocation(allocation);
539  SetIsAllocated();
540  } else {
541  construct_data = GetInlinedData();
542  }
543 
544  ConstructElements<A>(GetAllocator(), construct_data, values, new_size);
545 
546  // Since the initial size was guaranteed to be `0` and the allocated bit is
547  // already correct for either case, *adding* `new_size` gives us the correct
548  // result faster than setting it directly.
549  AddSize(new_size);
550 }
551 
552 template <typename T, size_t N, typename A>
553 template <typename ValueAdapter>
555  -> void {
556  StorageView<A> storage_view = MakeStorageView();
557 
558  AllocationTransaction<A> allocation_tx(GetAllocator());
559 
560  absl::Span<ValueType<A>> assign_loop;
561  absl::Span<ValueType<A>> construct_loop;
562  absl::Span<ValueType<A>> destroy_loop;
563 
564  if (new_size > storage_view.capacity) {
565  SizeType<A> requested_capacity =
566  ComputeCapacity(storage_view.capacity, new_size);
567  construct_loop = {allocation_tx.Allocate(requested_capacity), new_size};
568  destroy_loop = {storage_view.data, storage_view.size};
569  } else if (new_size > storage_view.size) {
570  assign_loop = {storage_view.data, storage_view.size};
571  construct_loop = {storage_view.data + storage_view.size,
572  new_size - storage_view.size};
573  } else {
574  assign_loop = {storage_view.data, new_size};
575  destroy_loop = {storage_view.data + new_size, storage_view.size - new_size};
576  }
577 
578  AssignElements<A>(assign_loop.data(), values, assign_loop.size());
579 
580  ConstructElements<A>(GetAllocator(), construct_loop.data(), values,
581  construct_loop.size());
582 
583  DestroyAdapter<A>::DestroyElements(GetAllocator(), destroy_loop.data(),
584  destroy_loop.size());
585 
586  if (allocation_tx.DidAllocate()) {
587  DeallocateIfAllocated();
588  SetAllocation(std::move(allocation_tx).Release());
589  SetIsAllocated();
590  }
591 
592  SetSize(new_size);
593 }
594 
595 template <typename T, size_t N, typename A>
596 template <typename ValueAdapter>
598  -> void {
599  StorageView<A> storage_view = MakeStorageView();
600  Pointer<A> const base = storage_view.data;
601  const SizeType<A> size = storage_view.size;
602  A& alloc = GetAllocator();
603  if (new_size <= size) {
604  // Destroy extra old elements.
606  } else if (new_size <= storage_view.capacity) {
607  // Construct new elements in place.
608  ConstructElements<A>(alloc, base + size, values, new_size - size);
609  } else {
610  // Steps:
611  // a. Allocate new backing store.
612  // b. Construct new elements in new backing store.
613  // c. Move existing elements from old backing store to new backing store.
614  // d. Destroy all elements in old backing store.
615  // Use transactional wrappers for the first two steps so we can roll
616  // back if necessary due to exceptions.
617  AllocationTransaction<A> allocation_tx(alloc);
618  SizeType<A> requested_capacity =
619  ComputeCapacity(storage_view.capacity, new_size);
620  Pointer<A> new_data = allocation_tx.Allocate(requested_capacity);
621 
622  ConstructionTransaction<A> construction_tx(alloc);
623  construction_tx.Construct(new_data + size, values, new_size - size);
624 
626  (MoveIterator<A>(base)));
627  ConstructElements<A>(alloc, new_data, move_values, size);
628 
630  std::move(construction_tx).Commit();
631  DeallocateIfAllocated();
632  SetAllocation(std::move(allocation_tx).Release());
633  SetIsAllocated();
634  }
635  SetSize(new_size);
636 }
637 
638 template <typename T, size_t N, typename A>
639 template <typename ValueAdapter>
641  SizeType<A> insert_count) -> Iterator<A> {
642  StorageView<A> storage_view = MakeStorageView();
643 
644  SizeType<A> insert_index =
645  std::distance(ConstIterator<A>(storage_view.data), pos);
646  SizeType<A> insert_end_index = insert_index + insert_count;
647  SizeType<A> new_size = storage_view.size + insert_count;
648 
649  if (new_size > storage_view.capacity) {
650  AllocationTransaction<A> allocation_tx(GetAllocator());
651  ConstructionTransaction<A> construction_tx(GetAllocator());
652  ConstructionTransaction<A> move_construction_tx(GetAllocator());
653 
655  MoveIterator<A>(storage_view.data));
656 
657  SizeType<A> requested_capacity =
658  ComputeCapacity(storage_view.capacity, new_size);
659  Pointer<A> new_data = allocation_tx.Allocate(requested_capacity);
660 
661  construction_tx.Construct(new_data + insert_index, values, insert_count);
662 
663  move_construction_tx.Construct(new_data, move_values, insert_index);
664 
665  ConstructElements<A>(GetAllocator(), new_data + insert_end_index,
666  move_values, storage_view.size - insert_index);
667 
668  DestroyAdapter<A>::DestroyElements(GetAllocator(), storage_view.data,
669  storage_view.size);
670 
671  std::move(construction_tx).Commit();
672  std::move(move_construction_tx).Commit();
673  DeallocateIfAllocated();
674  SetAllocation(std::move(allocation_tx).Release());
675 
676  SetAllocatedSize(new_size);
677  return Iterator<A>(new_data + insert_index);
678  } else {
679  SizeType<A> move_construction_destination_index =
680  (std::max)(insert_end_index, storage_view.size);
681 
682  ConstructionTransaction<A> move_construction_tx(GetAllocator());
683 
684  IteratorValueAdapter<A, MoveIterator<A>> move_construction_values(
685  MoveIterator<A>(storage_view.data +
686  (move_construction_destination_index - insert_count)));
687  absl::Span<ValueType<A>> move_construction = {
688  storage_view.data + move_construction_destination_index,
689  new_size - move_construction_destination_index};
690 
691  Pointer<A> move_assignment_values = storage_view.data + insert_index;
692  absl::Span<ValueType<A>> move_assignment = {
693  storage_view.data + insert_end_index,
694  move_construction_destination_index - insert_end_index};
695 
696  absl::Span<ValueType<A>> insert_assignment = {move_assignment_values,
697  move_construction.size()};
698 
699  absl::Span<ValueType<A>> insert_construction = {
700  insert_assignment.data() + insert_assignment.size(),
701  insert_count - insert_assignment.size()};
702 
703  move_construction_tx.Construct(move_construction.data(),
704  move_construction_values,
705  move_construction.size());
706 
707  for (Pointer<A>
708  destination = move_assignment.data() + move_assignment.size(),
709  last_destination = move_assignment.data(),
710  source = move_assignment_values + move_assignment.size();
711  ;) {
712  --destination;
713  --source;
714  if (destination < last_destination) break;
715  *destination = std::move(*source);
716  }
717 
718  AssignElements<A>(insert_assignment.data(), values,
719  insert_assignment.size());
720 
721  ConstructElements<A>(GetAllocator(), insert_construction.data(), values,
722  insert_construction.size());
723 
724  std::move(move_construction_tx).Commit();
725 
726  AddSize(insert_count);
727  return Iterator<A>(storage_view.data + insert_index);
728  }
729 }
730 
731 template <typename T, size_t N, typename A>
732 template <typename... Args>
734  StorageView<A> storage_view = MakeStorageView();
735  const SizeType<A> n = storage_view.size;
736  if (ABSL_PREDICT_TRUE(n != storage_view.capacity)) {
737  // Fast path; new element fits.
738  Pointer<A> last_ptr = storage_view.data + n;
739  AllocatorTraits<A>::construct(GetAllocator(), last_ptr,
740  std::forward<Args>(args)...);
741  AddSize(1);
742  return *last_ptr;
743  }
744  // TODO(b/173712035): Annotate with musttail attribute to prevent regression.
745  return EmplaceBackSlow(std::forward<Args>(args)...);
746 }
747 
748 template <typename T, size_t N, typename A>
749 template <typename... Args>
751  StorageView<A> storage_view = MakeStorageView();
752  AllocationTransaction<A> allocation_tx(GetAllocator());
754  MoveIterator<A>(storage_view.data));
755  SizeType<A> requested_capacity = NextCapacity(storage_view.capacity);
756  Pointer<A> construct_data = allocation_tx.Allocate(requested_capacity);
757  Pointer<A> last_ptr = construct_data + storage_view.size;
758 
759  // Construct new element.
760  AllocatorTraits<A>::construct(GetAllocator(), last_ptr,
761  std::forward<Args>(args)...);
762  // Move elements from old backing store to new backing store.
764  ConstructElements<A>(GetAllocator(), allocation_tx.GetData(), move_values,
765  storage_view.size);
766  }
768  AllocatorTraits<A>::destroy(GetAllocator(), last_ptr);
770  }
771  // Destroy elements in old backing store.
772  DestroyAdapter<A>::DestroyElements(GetAllocator(), storage_view.data,
773  storage_view.size);
774 
775  DeallocateIfAllocated();
776  SetAllocation(std::move(allocation_tx).Release());
777  SetIsAllocated();
778  AddSize(1);
779  return *last_ptr;
780 }
781 
782 template <typename T, size_t N, typename A>
784  -> Iterator<A> {
785  StorageView<A> storage_view = MakeStorageView();
786 
787  SizeType<A> erase_size = std::distance(from, to);
788  SizeType<A> erase_index =
789  std::distance(ConstIterator<A>(storage_view.data), from);
790  SizeType<A> erase_end_index = erase_index + erase_size;
791 
793  MoveIterator<A>(storage_view.data + erase_end_index));
794 
795  AssignElements<A>(storage_view.data + erase_index, move_values,
796  storage_view.size - erase_end_index);
797 
799  GetAllocator(), storage_view.data + (storage_view.size - erase_size),
800  erase_size);
801 
802  SubtractSize(erase_size);
803  return Iterator<A>(storage_view.data + erase_index);
804 }
805 
806 template <typename T, size_t N, typename A>
807 auto Storage<T, N, A>::Reserve(SizeType<A> requested_capacity) -> void {
808  StorageView<A> storage_view = MakeStorageView();
809 
810  if (ABSL_PREDICT_FALSE(requested_capacity <= storage_view.capacity)) return;
811 
812  AllocationTransaction<A> allocation_tx(GetAllocator());
813 
815  MoveIterator<A>(storage_view.data));
816 
817  SizeType<A> new_requested_capacity =
818  ComputeCapacity(storage_view.capacity, requested_capacity);
819  Pointer<A> new_data = allocation_tx.Allocate(new_requested_capacity);
820 
821  ConstructElements<A>(GetAllocator(), new_data, move_values,
822  storage_view.size);
823 
824  DestroyAdapter<A>::DestroyElements(GetAllocator(), storage_view.data,
825  storage_view.size);
826 
827  DeallocateIfAllocated();
828  SetAllocation(std::move(allocation_tx).Release());
829  SetIsAllocated();
830 }
831 
832 template <typename T, size_t N, typename A>
834  // May only be called on allocated instances!
835  ABSL_HARDENING_ASSERT(GetIsAllocated());
836 
837  StorageView<A> storage_view{GetAllocatedData(), GetSize(),
838  GetAllocatedCapacity()};
839 
840  if (ABSL_PREDICT_FALSE(storage_view.size == storage_view.capacity)) return;
841 
842  AllocationTransaction<A> allocation_tx(GetAllocator());
843 
845  MoveIterator<A>(storage_view.data));
846 
847  Pointer<A> construct_data;
848  if (storage_view.size > GetInlinedCapacity()) {
849  SizeType<A> requested_capacity = storage_view.size;
850  construct_data = allocation_tx.Allocate(requested_capacity);
851  if (allocation_tx.GetCapacity() >= storage_view.capacity) {
852  // Already using the smallest available heap allocation.
853  return;
854  }
855  } else {
856  construct_data = GetInlinedData();
857  }
858 
860  ConstructElements<A>(GetAllocator(), construct_data, move_values,
861  storage_view.size);
862  }
864  SetAllocation({storage_view.data, storage_view.capacity});
866  }
867 
868  DestroyAdapter<A>::DestroyElements(GetAllocator(), storage_view.data,
869  storage_view.size);
870 
871  MallocAdapter<A>::Deallocate(GetAllocator(), storage_view.data,
872  storage_view.capacity);
873 
874  if (allocation_tx.DidAllocate()) {
875  SetAllocation(std::move(allocation_tx).Release());
876  } else {
877  UnsetIsAllocated();
878  }
879 }
880 
881 template <typename T, size_t N, typename A>
882 auto Storage<T, N, A>::Swap(Storage* other_storage_ptr) -> void {
883  using std::swap;
884  ABSL_HARDENING_ASSERT(this != other_storage_ptr);
885 
886  if (GetIsAllocated() && other_storage_ptr->GetIsAllocated()) {
887  swap(data_.allocated, other_storage_ptr->data_.allocated);
888  } else if (!GetIsAllocated() && !other_storage_ptr->GetIsAllocated()) {
889  Storage* small_ptr = this;
890  Storage* large_ptr = other_storage_ptr;
891  if (small_ptr->GetSize() > large_ptr->GetSize()) swap(small_ptr, large_ptr);
892 
893  for (SizeType<A> i = 0; i < small_ptr->GetSize(); ++i) {
894  swap(small_ptr->GetInlinedData()[i], large_ptr->GetInlinedData()[i]);
895  }
896 
898  MoveIterator<A>(large_ptr->GetInlinedData() + small_ptr->GetSize()));
899 
900  ConstructElements<A>(large_ptr->GetAllocator(),
901  small_ptr->GetInlinedData() + small_ptr->GetSize(),
902  move_values,
903  large_ptr->GetSize() - small_ptr->GetSize());
904 
906  large_ptr->GetAllocator(),
907  large_ptr->GetInlinedData() + small_ptr->GetSize(),
908  large_ptr->GetSize() - small_ptr->GetSize());
909  } else {
910  Storage* allocated_ptr = this;
911  Storage* inlined_ptr = other_storage_ptr;
912  if (!allocated_ptr->GetIsAllocated()) swap(allocated_ptr, inlined_ptr);
913 
914  StorageView<A> allocated_storage_view{
915  allocated_ptr->GetAllocatedData(), allocated_ptr->GetSize(),
916  allocated_ptr->GetAllocatedCapacity()};
917 
919  MoveIterator<A>(inlined_ptr->GetInlinedData()));
920 
922  ConstructElements<A>(inlined_ptr->GetAllocator(),
923  allocated_ptr->GetInlinedData(), move_values,
924  inlined_ptr->GetSize());
925  }
927  allocated_ptr->SetAllocation(Allocation<A>{
928  allocated_storage_view.data, allocated_storage_view.capacity});
930  }
931 
933  inlined_ptr->GetInlinedData(),
934  inlined_ptr->GetSize());
935 
936  inlined_ptr->SetAllocation(Allocation<A>{allocated_storage_view.data,
937  allocated_storage_view.capacity});
938  }
939 
940  swap(GetSizeAndIsAllocated(), other_storage_ptr->GetSizeAndIsAllocated());
941  swap(GetAllocator(), other_storage_ptr->GetAllocator());
942 }
943 
944 // End ignore "array-bounds"
945 #if !defined(__clang__) && defined(__GNUC__)
946 #pragma GCC diagnostic pop
947 #endif
948 
949 } // namespace inlined_vector_internal
951 } // namespace absl
952 
953 #endif // ABSL_CONTAINER_INTERNAL_INLINED_VECTOR_INTERNAL_H_
ABSL_PREDICT_FALSE
#define ABSL_PREDICT_FALSE(x)
Definition: abseil-cpp/absl/base/optimization.h:180
absl::inlined_vector_internal::Storage::DestroyContents
ABSL_ATTRIBUTE_NOINLINE void DestroyContents()
Definition: abseil-cpp/absl/container/internal/inlined_vector.h:484
absl::inlined_vector_internal::Storage::EmplaceBackSlow
ABSL_ATTRIBUTE_NOINLINE Reference< A > EmplaceBackSlow(Args &&... args)
absl::inlined_vector_internal::StorageView
Definition: abseil-cpp/absl/container/internal/inlined_vector.h:164
absl::inlined_vector_internal::Storage::ComputeCapacity
static SizeType< A > ComputeCapacity(SizeType< A > current_capacity, SizeType< A > requested_capacity)
Definition: abseil-cpp/absl/container/internal/inlined_vector.h:304
_gevent_test_main.result
result
Definition: _gevent_test_main.py:96
absl::inlined_vector_internal::ConstructionTransaction::SizeType
typename AllocatorTraits::size_type SizeType
Definition: bloaty/third_party/abseil-cpp/absl/container/internal/inlined_vector.h:237
dst
static const char dst[]
Definition: test-fs-copyfile.c:37
absl::inlined_vector_internal::Storage::GetInlinedData
Pointer< A > GetInlinedData()
Definition: abseil-cpp/absl/container/internal/inlined_vector.h:349
regen-readme.it
it
Definition: regen-readme.py:15
absl::inlined_vector_internal::Storage::Swap
void Swap(Storage *other_storage_ptr)
Definition: abseil-cpp/absl/container/internal/inlined_vector.h:882
pos
int pos
Definition: libuv/docs/code/tty-gravity/main.c:11
absl::inlined_vector_internal::CopyValueAdapter::ConstPointer
typename AllocatorTraits::const_pointer ConstPointer
Definition: bloaty/third_party/abseil-cpp/absl/container/internal/inlined_vector.h:162
absl::inlined_vector_internal::Storage
Definition: abseil-cpp/absl/container/internal/inlined_vector.h:298
absl::inlined_vector_internal::AllocationTransaction::DidAllocate
bool DidAllocate()
Definition: abseil-cpp/absl/container/internal/inlined_vector.h:235
absl::inlined_vector_internal::Storage::UnsetIsAllocated
void UnsetIsAllocated()
Definition: abseil-cpp/absl/container/internal/inlined_vector.h:410
absl::inlined_vector_internal::ConstructionTransaction::~ConstructionTransaction
~ConstructionTransaction()
Definition: abseil-cpp/absl/container/internal/inlined_vector.h:267
absl::inlined_vector_internal::Allocation::capacity
SizeType< A > capacity
Definition: abseil-cpp/absl/container/internal/inlined_vector.h:124
absl::inlined_vector_internal::Storage::GetAllocatedCapacity
SizeType< A > GetAllocatedCapacity() const
Definition: abseil-cpp/absl/container/internal/inlined_vector.h:359
absl::conjunction
Definition: abseil-cpp/absl/meta/type_traits.h:230
false
#define false
Definition: setup_once.h:323
absl::inlined_vector_internal::ConstructionTransaction::GetData
Pointer< A > & GetData()
Definition: abseil-cpp/absl/container/internal/inlined_vector.h:277
absl::inlined_vector_internal::Storage::metadata_
Metadata metadata_
Definition: abseil-cpp/absl/container/internal/inlined_vector.h:479
capacity
uint16_t capacity
Definition: protobuf/src/google/protobuf/descriptor.cc:948
absl::inlined_vector_internal::Storage::MemcpyFrom
void MemcpyFrom(const Storage &other_storage)
Definition: abseil-cpp/absl/container/internal/inlined_vector.h:442
absl::Span
Definition: abseil-cpp/absl/types/span.h:152
absl::inlined_vector_internal::AllocationTransaction::AllocationTransaction
AllocationTransaction(A &allocator)
Definition: abseil-cpp/absl/container/internal/inlined_vector.h:219
absl::inlined_vector_internal::Storage::ShrinkToFit
void ShrinkToFit()
Definition: abseil-cpp/absl/container/internal/inlined_vector.h:833
absl::inlined_vector_internal::Storage::Reserve
void Reserve(SizeType< A > requested_capacity)
Definition: abseil-cpp/absl/container/internal/inlined_vector.h:807
absl::inlined_vector_internal::CopyValueAdapter::ptr_
ConstPointer< A > ptr_
Definition: abseil-cpp/absl/container/internal/inlined_vector.h:201
absl::inlined_vector_internal::DefaultValueAdapter::Pointer
typename AllocatorTraits::pointer Pointer
Definition: bloaty/third_party/abseil-cpp/absl/container/internal/inlined_vector.h:181
absl::inlined_vector_internal::ConstructionTransaction::operator=
void operator=(const ConstructionTransaction &)=delete
absl::inlined_vector_internal::Storage::Data::allocated
Allocated allocated
Definition: abseil-cpp/absl/container/internal/inlined_vector.h:472
absl::inlined_vector_internal::Storage::GetInlinedCapacity
SizeType< A > GetInlinedCapacity() const
Definition: abseil-cpp/absl/container/internal/inlined_vector.h:363
binary_size.new_size
def new_size
Definition: binary_size.py:124
absl::inlined_vector_internal::ValueType
typename AllocatorTraits< A >::value_type ValueType
Definition: abseil-cpp/absl/container/internal/inlined_vector.h:48
absl::inlined_vector_internal::DefaultValueAdapter::ConstructNext
void ConstructNext(A &allocator, Pointer< A > construct_at)
Definition: abseil-cpp/absl/container/internal/inlined_vector.h:209
absl::inlined_vector_internal::MallocAdapter::Deallocate
static void Deallocate(A &allocator, Pointer< A > pointer, SizeType< A > capacity)
Definition: abseil-cpp/absl/container/internal/inlined_vector.h:136
absl::inlined_vector_internal::Storage::AddSize
void AddSize(SizeType< A > count)
Definition: abseil-cpp/absl/container/internal/inlined_vector.h:427
u
OPENSSL_EXPORT pem_password_cb void * u
Definition: pem.h:351
absl::inlined_vector_internal::AllocationTransaction::SizeType
typename AllocatorTraits::size_type SizeType
Definition: bloaty/third_party/abseil-cpp/absl/container/internal/inlined_vector.h:197
absl::inlined_vector_internal::DestroyElements
void DestroyElements(AllocatorType *alloc_ptr, Pointer destroy_first, SizeType destroy_size)
Definition: bloaty/third_party/abseil-cpp/absl/container/internal/inlined_vector.h:57
absl::inlined_vector_internal::AllocationTransaction::Pointer
typename AllocatorTraits::pointer Pointer
Definition: bloaty/third_party/abseil-cpp/absl/container/internal/inlined_vector.h:196
to
size_t to
Definition: abseil-cpp/absl/container/internal/layout_test.cc:1385
absl::inlined_vector_internal::Storage::Storage
Storage(const A &allocator)
Definition: abseil-cpp/absl/container/internal/inlined_vector.h:315
absl::inlined_vector_internal::Storage::Insert
Iterator< A > Insert(ConstIterator< A > pos, ValueAdapter values, SizeType< A > insert_count)
ABSL_NAMESPACE_END
#define ABSL_NAMESPACE_END
Definition: third_party/abseil-cpp/absl/base/config.h:171
absl::allocator_traits::construct
static void construct(Alloc &a, T *p, Args &&... args)
Definition: third_party/abseil-cpp/absl/memory/memory.h:539
absl::inlined_vector_internal::AllocationTransaction::GetCapacity
SizeType< A > & GetCapacity()
Definition: abseil-cpp/absl/container/internal/inlined_vector.h:233
absl::inlined_vector_internal::IteratorValueAdapter::it_
Iterator it_
Definition: abseil-cpp/absl/container/internal/inlined_vector.h:186
ABSL_HARDENING_ASSERT
#define ABSL_HARDENING_ASSERT(expr)
Definition: abseil-cpp/absl/base/macros.h:134
T
#define T(upbtypeconst, upbtype, ctype, default_value)
absl::inlined_vector_internal::Allocation
Definition: abseil-cpp/absl/container/internal/inlined_vector.h:122
true
#define true
Definition: setup_once.h:324
absl::inlined_vector_internal::Storage::Assign
void Assign(ValueAdapter values, SizeType< A > new_size)
absl::inlined_vector_internal::AllocationTransaction::GetAllocator
A & GetAllocator()
Definition: abseil-cpp/absl/container/internal/inlined_vector.h:231
ABSL_ATTRIBUTE_NOINLINE
#define ABSL_ATTRIBUTE_NOINLINE
Definition: abseil-cpp/absl/base/attributes.h:112
absl::inlined_vector_internal::AllocationTransaction::Allocate
Pointer< A > Allocate(SizeType< A > requested_capacity)
Definition: abseil-cpp/absl/container/internal/inlined_vector.h:237
absl::inlined_vector_internal::Storage::SubtractSize
void SubtractSize(SizeType< A > count)
Definition: abseil-cpp/absl/container/internal/inlined_vector.h:431
absl::inlined_vector_internal::NoTypeDeduction
typename TypeIdentity< T >::type NoTypeDeduction
Definition: abseil-cpp/absl/container/internal/inlined_vector.h:94
absl::inlined_vector_internal::Storage::GetIsAllocated
bool GetIsAllocated() const
Definition: abseil-cpp/absl/container/internal/inlined_vector.h:341
absl::inlined_vector_internal::DefaultValueAdapter::DefaultValueAdapter
DefaultValueAdapter()
Definition: abseil-cpp/absl/container/internal/inlined_vector.h:207
from
size_t from
Definition: abseil-cpp/absl/container/internal/layout_test.cc:1384
absl::inlined_vector_internal::Storage::Allocated::allocated_data
Pointer< A > allocated_data
Definition: abseil-cpp/absl/container/internal/inlined_vector.h:463
ABSL_MUST_USE_RESULT
#define ABSL_MUST_USE_RESULT
Definition: abseil-cpp/absl/base/attributes.h:441
absl::inlined_vector_internal::CopyValueAdapter::AssignNext
void AssignNext(Pointer< A > assign_at)
Definition: abseil-cpp/absl/container/internal/inlined_vector.h:198
absl::inlined_vector_internal::Storage::Allocated
Definition: abseil-cpp/absl/container/internal/inlined_vector.h:462
memcpy
memcpy(mem, inblock.get(), min(CONTAINING_RECORD(inblock.get(), MEMBLOCK, data) ->size, size))
absl::inlined_vector_internal::Storage::MakeStorageView
StorageView< A > MakeStorageView()
Definition: abseil-cpp/absl/container/internal/inlined_vector.h:365
absl::inlined_vector_internal::DestroyAdapter
Definition: abseil-cpp/absl/container/internal/inlined_vector.h:98
absl::inlined_vector_internal::Storage::GetAllocator
A & GetAllocator()
Definition: abseil-cpp/absl/container/internal/inlined_vector.h:372
absl::inlined_vector_internal::Storage::GetAllocatedData
Pointer< A > GetAllocatedData()
Definition: abseil-cpp/absl/container/internal/inlined_vector.h:343
absl::inlined_vector_internal::ConstructionTransaction::Commit
void Commit() &&
Definition: abseil-cpp/absl/container/internal/inlined_vector.h:287
absl::inlined_vector_internal::Storage::SetInlinedSize
void SetInlinedSize(SizeType< A > size)
Definition: abseil-cpp/absl/container/internal/inlined_vector.h:423
ABSL_NAMESPACE_BEGIN
#define ABSL_NAMESPACE_BEGIN
Definition: third_party/abseil-cpp/absl/base/config.h:170
absl::inlined_vector_internal::CopyValueAdapter
Definition: abseil-cpp/absl/container/internal/inlined_vector.h:190
asyncio_get_stats.args
args
Definition: asyncio_get_stats.py:40
absl::move
constexpr absl::remove_reference_t< T > && move(T &&t) noexcept
Definition: abseil-cpp/absl/utility/utility.h:221
hpack_encoder_fixtures::Args
Args({0, 16384})
absl::inlined_vector_internal::StorageView::data
Pointer< A > data
Definition: abseil-cpp/absl/container/internal/inlined_vector.h:165
absl::inlined_vector_internal::Storage::Inlined::inlined_data
char inlined_data[sizeof(ValueType< A >[N])]
Definition: abseil-cpp/absl/container/internal/inlined_vector.h:468
absl::inlined_vector_internal::Storage::Erase
Iterator< A > Erase(ConstIterator< A > from, ConstIterator< A > to)
Definition: abseil-cpp/absl/container/internal/inlined_vector.h:783
max
int max
Definition: bloaty/third_party/zlib/examples/enough.c:170
absl::inlined_vector_internal::Storage::DeallocateIfAllocated
void DeallocateIfAllocated()
Definition: abseil-cpp/absl/container/internal/inlined_vector.h:450
absl::inlined_vector_internal::Storage::GetAllocator
const A & GetAllocator() const
Definition: abseil-cpp/absl/container/internal/inlined_vector.h:374
absl::inlined_vector_internal::AllocationTransaction::Release
ABSL_MUST_USE_RESULT Allocation< A > Release() &&
Definition: abseil-cpp/absl/container/internal/inlined_vector.h:245
absl::inlined_vector_internal::Storage::data_
Data data_
Definition: abseil-cpp/absl/container/internal/inlined_vector.h:480
absl::inlined_vector_internal::ConstIterator
ConstPointer< A > ConstIterator
Definition: abseil-cpp/absl/container/internal/inlined_vector.h:66
absl::inlined_vector_internal::DefaultValueAdapter::ValueType
typename AllocatorTraits::value_type ValueType
Definition: bloaty/third_party/abseil-cpp/absl/container/internal/inlined_vector.h:180
absl::inlined_vector_internal::IteratorValueAdapter
Definition: abseil-cpp/absl/container/internal/inlined_vector.h:171
absl::inlined_vector_internal::ConstructionTransaction::Construct
void Construct(Pointer< A > data, ValueAdapter &values, SizeType< A > size)
Definition: abseil-cpp/absl/container/internal/inlined_vector.h:282
absl::inlined_vector_internal::ConstPointer
typename AllocatorTraits< A >::const_pointer ConstPointer
Definition: abseil-cpp/absl/container/internal/inlined_vector.h:54
absl::inlined_vector_internal::IteratorValueAdapter::IteratorValueAdapter
IteratorValueAdapter(const Iterator &it)
Definition: abseil-cpp/absl/container/internal/inlined_vector.h:173
absl::inlined_vector_internal::CopyValueAdapter::ConstructNext
void ConstructNext(A &allocator, Pointer< A > construct_at)
Definition: abseil-cpp/absl/container/internal/inlined_vector.h:194
absl::inlined_vector_internal::ConstReverseIterator
typename std::reverse_iterator< ConstIterator< A > > ConstReverseIterator
Definition: abseil-cpp/absl/container/internal/inlined_vector.h:70
absl::swap
void swap(btree_map< K, V, C, A > &x, btree_map< K, V, C, A > &y)
Definition: abseil-cpp/absl/container/btree_map.h:474
absl::inlined_vector_internal::ConstructionTransaction::Pointer
typename AllocatorTraits::pointer Pointer
Definition: bloaty/third_party/abseil-cpp/absl/container/internal/inlined_vector.h:236
absl::inlined_vector_internal::Storage::Storage
Storage()
Definition: abseil-cpp/absl/container/internal/inlined_vector.h:313
absl::inlined_vector_internal::MallocAdapter::Allocate
static Allocation< A > Allocate(A &allocator, SizeType< A > requested_capacity)
Definition: abseil-cpp/absl/container/internal/inlined_vector.h:131
absl::inlined_vector_internal::IteratorValueAdapter::AssignNext
void AssignNext(Pointer< A > assign_at)
Definition: abseil-cpp/absl/container/internal/inlined_vector.h:180
absl::inlined_vector_internal::Storage::SetIsAllocated
void SetIsAllocated()
Definition: abseil-cpp/absl/container/internal/inlined_vector.h:406
absl::inlined_vector_internal::ConstructionTransaction::GetSize
SizeType< A > & GetSize()
Definition: abseil-cpp/absl/container/internal/inlined_vector.h:278
absl::inlined_vector_internal::MallocAdapter
Definition: abseil-cpp/absl/container/internal/inlined_vector.h:130
absl::inlined_vector_internal::Pointer
typename AllocatorTraits< A >::pointer Pointer
Definition: abseil-cpp/absl/container/internal/inlined_vector.h:52
std::swap
void swap(Json::Value &a, Json::Value &b)
Specialize std::swap() for Json::Value.
Definition: third_party/bloaty/third_party/protobuf/conformance/third_party/jsoncpp/json.h:1226
absl::inlined_vector_internal::StorageView::size
SizeType< A > size
Definition: abseil-cpp/absl/container/internal/inlined_vector.h:166
absl::inlined_vector_internal::AllocationTransaction::~AllocationTransaction
~AllocationTransaction()
Definition: abseil-cpp/absl/container/internal/inlined_vector.h:222
absl::inlined_vector_internal::AssignElements
void AssignElements(Pointer< A > assign_first, ValueAdapter &values, SizeType< A > assign_size)
Definition: abseil-cpp/absl/container/internal/inlined_vector.h:156
gen_synthetic_protos.base
base
Definition: gen_synthetic_protos.py:31
absl::inlined_vector_internal::Allocation::data
Pointer< A > data
Definition: abseil-cpp/absl/container/internal/inlined_vector.h:123
data
char data[kBufferLength]
Definition: abseil-cpp/absl/strings/internal/str_format/float_conversion.cc:1006
absl::inlined_vector_internal::AllocationTransaction::operator=
void operator=(const AllocationTransaction &)=delete
absl::inlined_vector_internal::ConstructionTransaction::GetAllocator
A & GetAllocator()
Definition: abseil-cpp/absl/container/internal/inlined_vector.h:276
absl::inlined_vector_internal::IteratorValueAdapter::ConstructNext
void ConstructNext(A &allocator, Pointer< A > construct_at)
Definition: abseil-cpp/absl/container/internal/inlined_vector.h:175
absl::container_internal::CompressedTuple
Definition: abseil-cpp/absl/container/internal/compressed_tuple.h:55
absl::inlined_vector_internal::ConstructionTransaction
Definition: abseil-cpp/absl/container/internal/inlined_vector.h:262
n
int n
Definition: abseil-cpp/absl/container/btree_test.cc:1080
ABSL_PREDICT_TRUE
#define ABSL_PREDICT_TRUE(x)
Definition: abseil-cpp/absl/base/optimization.h:181
absl::inlined_vector_internal::ConstructionTransaction::size_
SizeType< A > size_
Definition: abseil-cpp/absl/container/internal/inlined_vector.h:294
absl::inlined_vector_internal::Storage::InitFrom
ABSL_ATTRIBUTE_NOINLINE void InitFrom(const Storage &other)
Definition: abseil-cpp/absl/container/internal/inlined_vector.h:491
absl::inlined_vector_internal::Storage::NextCapacity
static SizeType< A > NextCapacity(SizeType< A > current_capacity)
Definition: abseil-cpp/absl/container/internal/inlined_vector.h:300
value
const char * value
Definition: hpack_parser_table.cc:165
absl::inlined_vector_internal::AllocationTransaction::capacity_
SizeType< A > capacity_
Definition: abseil-cpp/absl/container/internal/inlined_vector.h:258
absl::inlined_vector_internal::DefaultValueAdapter::AssignNext
void AssignNext(Pointer< A > assign_at)
Definition: abseil-cpp/absl/container/internal/inlined_vector.h:213
absl::inlined_vector_internal::Storage::GetSizeAndIsAllocated
const SizeType< A > & GetSizeAndIsAllocated() const
Definition: abseil-cpp/absl/container/internal/inlined_vector.h:335
absl::inlined_vector_internal::AllocationTransaction::Reset
void Reset()
Definition: abseil-cpp/absl/container/internal/inlined_vector.h:252
construct
static std::function< void(void *, Slot *, Slot)> construct
Definition: abseil-cpp/absl/container/internal/hash_policy_traits_test.cc:41
absl::inlined_vector_internal::ReverseIterator
typename std::reverse_iterator< Iterator< A > > ReverseIterator
Definition: abseil-cpp/absl/container/internal/inlined_vector.h:68
absl::inlined_vector_internal::TypeIdentity
Definition: abseil-cpp/absl/container/internal/inlined_vector.h:87
absl::inlined_vector_internal::AllocationTransaction::GetData
Pointer< A > & GetData()
Definition: abseil-cpp/absl/container/internal/inlined_vector.h:232
absl::inlined_vector_internal::AllocatorTraits
std::allocator_traits< A > AllocatorTraits
Definition: abseil-cpp/absl/container/internal/inlined_vector.h:46
absl::inlined_vector_internal::StorageView::capacity
SizeType< A > capacity
Definition: abseil-cpp/absl/container/internal/inlined_vector.h:167
absl::inlined_vector_internal::Storage::SetAllocatedSize
void SetAllocatedSize(SizeType< A > size)
Definition: abseil-cpp/absl/container/internal/inlined_vector.h:419
absl::inlined_vector_internal::Storage::~Storage
~Storage()
Definition: abseil-cpp/absl/container/internal/inlined_vector.h:318
absl::inlined_vector_internal::Storage::GetSize
SizeType< A > GetSize() const
Definition: abseil-cpp/absl/container/internal/inlined_vector.h:339
N
#define N
Definition: sync_test.cc:37
absl::inlined_vector_internal::DestroyAdapter< A, true >::DestroyElements
static void DestroyElements(A &allocator, Pointer< A > destroy_first, SizeType< A > destroy_size)
Definition: abseil-cpp/absl/container/internal/inlined_vector.h:113
absl::is_trivially_copy_assignable
Definition: abseil-cpp/absl/meta/type_traits.h:492
absl::inlined_vector_internal::Storage::Inlined
Definition: abseil-cpp/absl/container/internal/inlined_vector.h:467
ABSL_INTERNAL_CATCH_ANY
#define ABSL_INTERNAL_CATCH_ANY
Definition: abseil-cpp/absl/base/macros.h:143
count
int * count
Definition: bloaty/third_party/googletest/googlemock/test/gmock_stress_test.cc:96
absl::inlined_vector_internal::CopyValueAdapter::Pointer
typename AllocatorTraits::pointer Pointer
Definition: bloaty/third_party/abseil-cpp/absl/container/internal/inlined_vector.h:161
ABSL_INTERNAL_TRY
#define ABSL_INTERNAL_TRY
Definition: abseil-cpp/absl/base/macros.h:142
absl::Span::size
constexpr size_type size() const noexcept
Definition: abseil-cpp/absl/types/span.h:261
absl::inlined_vector_internal::Storage::GetInlinedData
ConstPointer< A > GetInlinedData() const
Definition: abseil-cpp/absl/container/internal/inlined_vector.h:354
absl::inlined_vector_internal::Reference
ValueType< A > & Reference
Definition: abseil-cpp/absl/container/internal/inlined_vector.h:60
absl::inlined_vector_internal::Storage::Initialize
void Initialize(ValueAdapter values, SizeType< A > new_size)
A
Definition: miscompile_with_no_unique_address_test.cc:23
absl::is_trivially_copy_constructible
Definition: abseil-cpp/absl/meta/type_traits.h:418
values
std::array< int64_t, Size > values
Definition: abseil-cpp/absl/container/btree_benchmark.cc:608
absl::inlined_vector_internal::StorageView::Pointer
typename AllocatorTraits::pointer Pointer
Definition: bloaty/third_party/abseil-cpp/absl/container/internal/inlined_vector.h:127
data_
std::string data_
Definition: cord_rep_btree_navigator_test.cc:84
absl::inlined_vector_internal::AllocationTransaction
Definition: abseil-cpp/absl/container/internal/inlined_vector.h:217
absl::inlined_vector_internal::TypeIdentity::type
T type
Definition: abseil-cpp/absl/container/internal/inlined_vector.h:88
absl::inlined_vector_internal::Storage::EmplaceBack
Reference< A > EmplaceBack(Args &&... args)
absl::inlined_vector_internal::Storage::SetAllocation
void SetAllocation(Allocation< A > allocation)
Definition: abseil-cpp/absl/container/internal/inlined_vector.h:437
absl::inlined_vector_internal::Storage::GetAllocatedData
ConstPointer< A > GetAllocatedData() const
Definition: abseil-cpp/absl/container/internal/inlined_vector.h:345
absl::inlined_vector_internal::Storage< typename Which::ValueType, N, std::allocator< typename Which::ValueType > >::MoveIterator
std::move_iterator< iterator > MoveIterator
Definition: bloaty/third_party/abseil-cpp/absl/container/internal/inlined_vector.h:293
absl::inlined_vector_internal::Iterator
Pointer< A > Iterator
Definition: abseil-cpp/absl/container/internal/inlined_vector.h:64
absl::inlined_vector_internal::CopyValueAdapter::CopyValueAdapter
CopyValueAdapter(ConstPointer< A > p)
Definition: abseil-cpp/absl/container/internal/inlined_vector.h:192
absl::inlined_vector_internal::Storage::Resize
void Resize(ValueAdapter values, SizeType< A > new_size)
absl::inlined_vector_internal::StorageView::SizeType
typename AllocatorTraits::size_type SizeType
Definition: bloaty/third_party/abseil-cpp/absl/container/internal/inlined_vector.h:128
absl::inlined_vector_internal::DestroyAdapter< A, false >::DestroyElements
static void DestroyElements(A &allocator, Pointer< A > destroy_first, SizeType< A > destroy_size)
Definition: abseil-cpp/absl/container/internal/inlined_vector.h:102
absl::inlined_vector_internal::Storage::Allocated::allocated_capacity
SizeType< A > allocated_capacity
Definition: abseil-cpp/absl/container/internal/inlined_vector.h:464
absl::inlined_vector_internal::DefaultValueAdapter
Definition: abseil-cpp/absl/container/internal/inlined_vector.h:205
absl::inlined_vector_internal::MoveIterator
typename std::move_iterator< Iterator< A > > MoveIterator
Definition: abseil-cpp/absl/container/internal/inlined_vector.h:72
absl
Definition: abseil-cpp/absl/algorithm/algorithm.h:31
absl::inlined_vector_internal::Storage::SetSize
void SetSize(SizeType< A > size)
Definition: abseil-cpp/absl/container/internal/inlined_vector.h:414
absl::is_trivially_destructible
Definition: abseil-cpp/absl/meta/type_traits.h:63
size
voidpf void uLong size
Definition: bloaty/third_party/zlib/contrib/minizip/ioapi.h:136
absl::inlined_vector_internal::IteratorValueAdapter::Pointer
typename AllocatorTraits::pointer Pointer
Definition: bloaty/third_party/abseil-cpp/absl/container/internal/inlined_vector.h:138
absl::inlined_vector_internal::ConstReference
const ValueType< A > & ConstReference
Definition: abseil-cpp/absl/container/internal/inlined_vector.h:62
absl::inlined_vector_internal::Storage::Data
Definition: abseil-cpp/absl/container/internal/inlined_vector.h:471
absl::inlined_vector_internal::Storage::Data::inlined
Inlined inlined
Definition: abseil-cpp/absl/container/internal/inlined_vector.h:473
absl::inlined_vector_internal::ConstructionTransaction::allocator_data_
container_internal::CompressedTuple< A, Pointer< A > > allocator_data_
Definition: abseil-cpp/absl/container/internal/inlined_vector.h:293
absl::inlined_vector_internal::ConstructionTransaction::DidConstruct
bool DidConstruct()
Definition: abseil-cpp/absl/container/internal/inlined_vector.h:280
absl::Span::data
constexpr pointer data() const noexcept
Definition: abseil-cpp/absl/types/span.h:256
absl::inlined_vector_internal::ConstructElements
void ConstructElements(NoTypeDeduction< A > &allocator, Pointer< A > construct_first, ValueAdapter &values, SizeType< A > construct_size)
Definition: abseil-cpp/absl/container/internal/inlined_vector.h:143
absl::inlined_vector_internal::IsAtLeastForwardIterator
std::is_convertible< typename std::iterator_traits< Iterator >::iterator_category, std::forward_iterator_tag > IsAtLeastForwardIterator
Definition: abseil-cpp/absl/container/internal/inlined_vector.h:77
alloc
std::allocator< int > alloc
Definition: abseil-cpp/absl/container/internal/hash_policy_traits_test.cc:87
absl::inlined_vector_internal::AllocationTransaction::allocator_data_
container_internal::CompressedTuple< A, Pointer< A > > allocator_data_
Definition: abseil-cpp/absl/container/internal/inlined_vector.h:257
destroy
static std::function< void(void *, Slot *)> destroy
Definition: abseil-cpp/absl/container/internal/hash_policy_traits_test.cc:42
absl::inlined_vector_internal::DifferenceType
typename AllocatorTraits< A >::difference_type DifferenceType
Definition: abseil-cpp/absl/container/internal/inlined_vector.h:58
i
uint64_t i
Definition: abseil-cpp/absl/container/btree_benchmark.cc:230
ABSL_INTERNAL_RETHROW
#define ABSL_INTERNAL_RETHROW
Definition: abseil-cpp/absl/base/macros.h:144
ABSL_INTERNAL_DEFAULT_NEW_ALIGNMENT
#define ABSL_INTERNAL_DEFAULT_NEW_ALIGNMENT
Definition: abseil-cpp/absl/meta/type_traits.h:55
absl::inlined_vector_internal::SizeType
typename AllocatorTraits< A >::size_type SizeType
Definition: abseil-cpp/absl/container/internal/inlined_vector.h:50
absl::inlined_vector_internal::ConstructionTransaction::ConstructionTransaction
ConstructionTransaction(A &allocator)
Definition: abseil-cpp/absl/container/internal/inlined_vector.h:264
absl::inlined_vector_internal::Storage::GetSizeAndIsAllocated
SizeType< A > & GetSizeAndIsAllocated()
Definition: abseil-cpp/absl/container/internal/inlined_vector.h:333


grpc
Author(s):
autogenerated on Fri May 16 2025 02:59:03