aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVijay Pai <vpai@google.com>2016-06-15 20:42:30 -0700
committerFeng Xiao <xfxyjwf@gmail.com>2016-06-17 11:24:02 -0700
commit4e5dadb13650fa12893edfcc0433ec1eb1ba5829 (patch)
tree50037204481ec928bde7c907c5c73736004e3b79
parent3470b6895aa659b7559ed678e029a5338e535f14 (diff)
downloadprotobuf-4e5dadb13650fa12893edfcc0433ec1eb1ba5829.tar.gz
protobuf-4e5dadb13650fa12893edfcc0433ec1eb1ba5829.tar.bz2
protobuf-4e5dadb13650fa12893edfcc0433ec1eb1ba5829.zip
Remove a friend-class template that is only used for the
constructor, and instead create an _internal_only getter that gets the needed information. This is a workaround for a deficiency in gcc-4.4 that does not properly support templated friend classes.
-rw-r--r--src/google/protobuf/map.h11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/google/protobuf/map.h b/src/google/protobuf/map.h
index 6f1a71e4..7f4acd0d 100644
--- a/src/google/protobuf/map.h
+++ b/src/google/protobuf/map.h
@@ -587,7 +587,7 @@ class Map {
explicit MapAllocator(Arena* arena) : arena_(arena) {}
template <typename X>
MapAllocator(const MapAllocator<X>& allocator)
- : arena_(allocator.arena_) {}
+ : arena_(allocator.arena_internal_only()) {}
pointer allocate(size_type n, const_pointer hint = 0) {
// If arena is not given, malloc needs to be called which doesn't
@@ -650,12 +650,15 @@ class Map {
return std::numeric_limits<size_type>::max();
}
+ // To support gcc-4.4, which does not properly
+ // support templated friend classes
+ Arena* arena_internal_only() const {
+ return arena_;
+ }
+
private:
typedef void DestructorSkippable_;
Arena* const arena_;
-
- template <typename X>
- friend class MapAllocator;
};
// InnerMap's key type is Key and its value type is value_type*. We use a