Commit a2d09ab3 authored by Jordan DeLong's avatar Jordan DeLong Committed by Sara Golemon

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
parent 79345bbc
...@@ -208,6 +208,8 @@ class allocator_delete ...@@ -208,6 +208,8 @@ class allocator_delete
typedef typename std::remove_reference<Allocator>::type allocator_type; typedef typename std::remove_reference<Allocator>::type allocator_type;
public: public:
typedef typename Allocator::pointer pointer;
allocator_delete() = default; allocator_delete() = default;
explicit allocator_delete(const allocator_type& allocator) explicit allocator_delete(const allocator_type& allocator)
...@@ -223,9 +225,11 @@ public: ...@@ -223,9 +225,11 @@ public:
: allocator_type(other.get_allocator()) : allocator_type(other.get_allocator())
{} {}
allocator_type& get_allocator() const { return *this; } allocator_type& get_allocator() const {
return *const_cast<allocator_delete*>(this);
}
void operator()(typename allocator_type::pointer p) const { void operator()(pointer p) const {
if (!p) return; if (!p) return;
const_cast<allocator_delete*>(this)->destroy(p); const_cast<allocator_delete*>(this)->destroy(p);
const_cast<allocator_delete*>(this)->deallocate(p, 1); const_cast<allocator_delete*>(this)->deallocate(p, 1);
......
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