Commit 37eaae20 authored by Vijay Pai's avatar Vijay Pai

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.
parent 52598c64
...@@ -587,7 +587,7 @@ class Map { ...@@ -587,7 +587,7 @@ class Map {
explicit MapAllocator(Arena* arena) : arena_(arena) {} explicit MapAllocator(Arena* arena) : arena_(arena) {}
template <typename X> template <typename X>
MapAllocator(const MapAllocator<X>& allocator) MapAllocator(const MapAllocator<X>& allocator)
: arena_(allocator.arena_) {} : arena_(allocator.arena_internal_only()) {}
pointer allocate(size_type n, const_pointer hint = 0) { pointer allocate(size_type n, const_pointer hint = 0) {
// If arena is not given, malloc needs to be called which doesn't // If arena is not given, malloc needs to be called which doesn't
...@@ -650,12 +650,15 @@ class Map { ...@@ -650,12 +650,15 @@ class Map {
return std::numeric_limits<size_type>::max(); 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: private:
typedef void DestructorSkippable_; typedef void DestructorSkippable_;
Arena* const arena_; 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 // InnerMap's key type is Key and its value type is value_type*. We use a
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment