Implementing unique/shared_ptr for custom allocators (like Arena) in folly
authorMarcelo Juchem <marcelo@fb.com>
Tue, 8 Jan 2013 03:05:53 +0000 (19:05 -0800)
committerJordan DeLong <jdelong@fb.com>
Mon, 4 Feb 2013 17:25:50 +0000 (09:25 -0800)
commitcc86cd35792f320d4111fac91ca88f1733266a8a
tree83afdb0e5e6828d9eb4e19d407d7723a8b64a0e1
parentfe26f5beb9ee9874a0b18273d8f8df6363e87682
Implementing unique/shared_ptr for custom allocators (like Arena) in folly

Summary:
- moving simple allocator *_ptr and convenience functions to folly
- getting rid of arena_new - it encourages manually constructing smart pointers when folly::allocate_* should be used instead
- using std::allocate_shared to construct shared_ptrs, thus properly using the allocator for the ref-counter too
- fixing forwarding of parameters in the convenience functions
- uniform allocation of smart pointers using both stl and non stl-like allocators

Test Plan:
- build + tests of existing client code
- basic unit tests for arena smart pointers

Reviewed By: delong.j@fb.com

FB internal diff: D672818
folly/StlAllocator.h
folly/Traits.h
folly/test/ArenaSmartPtrTest.cpp [new file with mode: 0644]
folly/test/HasMemberFnTraitsTest.cpp [new file with mode: 0644]