aboutsummaryrefslogtreecommitdiff
path: root/src/google/protobuf/map.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/google/protobuf/map.h')
-rw-r--r--src/google/protobuf/map.h12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/google/protobuf/map.h b/src/google/protobuf/map.h
index bfc63b0f..2d295510 100644
--- a/src/google/protobuf/map.h
+++ b/src/google/protobuf/map.h
@@ -565,7 +565,7 @@ class Map {
void Init() {
if (old_style_)
deprecated_elements_ = Arena::Create<DeprecatedInnerMap>(
- arena_, 0, hasher(), equal_to<Key>(),
+ arena_, 0, hasher(), std::equal_to<Key>(),
MapAllocator<std::pair<const Key, MapPair<Key, T>*> >(arena_));
else
elements_ =
@@ -596,7 +596,7 @@ class Map {
// If arena is not given, malloc needs to be called which doesn't
// construct element object.
if (arena_ == NULL) {
- return reinterpret_cast<pointer>(malloc(n * sizeof(value_type)));
+ return static_cast<pointer>(::operator new(n * sizeof(value_type)));
} else {
return reinterpret_cast<pointer>(
Arena::CreateArray<uint8>(arena_, n * sizeof(value_type)));
@@ -605,7 +605,11 @@ class Map {
void deallocate(pointer p, size_type n) {
if (arena_ == NULL) {
- free(p);
+#if defined(__GXX_DELETE_WITH_SIZE__) || defined(__cpp_sized_deallocation)
+ ::operator delete(p, n * sizeof(value_type));
+#else
+ ::operator delete(p);
+#endif
}
}
@@ -1351,7 +1355,7 @@ class Map {
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(InnerMap);
}; // end of class InnerMap
- typedef hash_map<Key, value_type*, hash<Key>, equal_to<Key>,
+ typedef hash_map<Key, value_type*, hash<Key>, std::equal_to<Key>,
MapAllocator<std::pair<const Key, MapPair<Key, T>*> > >
DeprecatedInnerMap;