summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Ryan Prichard <rprichard@google.com> 2023-07-26 02:32:57 +0000
committer Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> 2023-07-26 02:32:57 +0000
commit8548e36faaa67480890a82f1c945c8fbe0cc27ab (patch)
tree63c1bed78066389400eb8f4dee5a341c10295f09
parent1b135b93285a81bccd64b99bacf2dcbdeb478a25 (diff)
parent5b528cf0435d4baa1d333c94bfc492ab42e1e5e0 (diff)
Merge "Add InlineStdAllocator::rebind struct member" into main am: e66246347c am: 770c1df5cb am: 5b528cf043
Original change: https://android-review.googlesource.com/c/platform/frameworks/native/+/2673907 Change-Id: Ie2ee22fd0063674efbd4a4f831a19daafc9db7ae Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r--libs/ui/include/ui/FatVector.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/libs/ui/include/ui/FatVector.h b/libs/ui/include/ui/FatVector.h
index cb61e6a320..494272b1a8 100644
--- a/libs/ui/include/ui/FatVector.h
+++ b/libs/ui/include/ui/FatVector.h
@@ -65,6 +65,17 @@ public:
free(p);
}
}
+
+ // The STL checks that this member type is present so that
+ // std::allocator_traits<InlineStdAllocator<T, SIZE>>::rebind_alloc<Other>
+ // works. std::vector won't be able to construct an
+ // InlineStdAllocator<Other, SIZE>, because InlineStdAllocator has no
+ // default constructor, but vector presumably doesn't rebind the allocator
+ // because it doesn't allocate internal node types.
+ template <class Other>
+ struct rebind {
+ typedef InlineStdAllocator<Other, SIZE> other;
+ };
Allocation& mAllocation;
};