From: Jordan DeLong Date: Mon, 3 Jun 2013 23:14:50 +0000 (-0700) Subject: Fix some issues in allocator_delete X-Git-Tag: v0.22.0~951 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=a2d09ab3345f5f8c4ddb2e5db47c4b8366ed5669;p=folly.git Fix some issues in allocator_delete Summary: The unique_ptr implementation was getting confused about how to determine the pointer type, so just tell it. Facebook: Broke the fxl build; test plan included recompiling it. Test Plan: Built. Reviewed By: marcelo.juchem@fb.com FB internal diff: D834371 --- diff --git a/folly/Memory.h b/folly/Memory.h index 3be3d78f..5a1059bd 100644 --- a/folly/Memory.h +++ b/folly/Memory.h @@ -208,6 +208,8 @@ class allocator_delete typedef typename std::remove_reference::type allocator_type; public: + typedef typename Allocator::pointer pointer; + allocator_delete() = default; explicit allocator_delete(const allocator_type& allocator) @@ -223,9 +225,11 @@ public: : allocator_type(other.get_allocator()) {} - allocator_type& get_allocator() const { return *this; } + allocator_type& get_allocator() const { + return *const_cast(this); + } - void operator()(typename allocator_type::pointer p) const { + void operator()(pointer p) const { if (!p) return; const_cast(this)->destroy(p); const_cast(this)->deallocate(p, 1);