diff options
author | 2016-01-12 14:23:14 -0800 | |
---|---|---|
committer | 2016-01-12 14:23:14 -0800 | |
commit | afeb309e0e4a1c2c35fc86f99c14649fa44c942d (patch) | |
tree | 82bcfd5b57493ef18c93e4187d056490fdcf82db | |
parent | f5ef541b3ae782d99687cc3354c5d4094abb261c (diff) |
Correct value_type for some TrackingAllocators.
The standard says that the value_type for the allocator of a
map/multimap must be std::pair<const Key, T>. These instances were not
properly carrying the const, and the updated version of libc++ has a
static_assert to make sure that map::allocator_type and
allocator::value_type really do match (as mismatches will tickle
undefined behavior in libc++).
Change-Id: I7a3a49fccea4ecc4579929d9ddd7872c62b60f5f
-rw-r--r-- | runtime/base/allocator.h | 2 | ||||
-rw-r--r-- | runtime/safe_map.h | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/runtime/base/allocator.h b/runtime/base/allocator.h index 969f5b953f..cea704627c 100644 --- a/runtime/base/allocator.h +++ b/runtime/base/allocator.h @@ -158,7 +158,7 @@ using TrackingAllocator = typename TypeStaticIf<kEnableTrackingAllocator, template<class Key, class T, AllocatorTag kTag, class Compare = std::less<Key>> using AllocationTrackingMultiMap = std::multimap< - Key, T, Compare, TrackingAllocator<std::pair<Key, T>, kTag>>; + Key, T, Compare, TrackingAllocator<std::pair<const Key, T>, kTag>>; template<class Key, AllocatorTag kTag, class Compare = std::less<Key>> using AllocationTrackingSet = std::set<Key, Compare, TrackingAllocator<Key, kTag>>; diff --git a/runtime/safe_map.h b/runtime/safe_map.h index 4e62dda8dd..a8b48ee4dc 100644 --- a/runtime/safe_map.h +++ b/runtime/safe_map.h @@ -146,7 +146,7 @@ bool operator!=(const SafeMap<K, V, Comparator, Allocator>& lhs, template<class Key, class T, AllocatorTag kTag, class Compare = std::less<Key>> class AllocationTrackingSafeMap : public SafeMap< - Key, T, Compare, TrackingAllocator<std::pair<Key, T>, kTag>> { + Key, T, Compare, TrackingAllocator<std::pair<const Key, T>, kTag>> { }; } // namespace art |