Fix allocate_unique for cases where allocator with different type is provided
Summary: While working on adding allocator support for thrift reference data types (cpp.ref) I realized that allocate_unique always expects the allocator to be of the same type. This means we cannot allocate a unique_ptr<T> with a Alloc<char>. Other allocate methods like std::allocate_shared allows this and it is quite useful. This is critical since it is almost impossible to pass a scoped_allocator of a different type for all the containers in a struct if this kind of allocator type conversion magic is not supported. This diff adds support to folly::allocate_unique to use an allocator for different type. Reviewed By: yfeldblum Differential Revision: D33026177 fbshipit-source-id: 88c43374c2482b76697485c1667064441a057117
Showing
Please register or sign in to comment