Commit 0781f3a8 authored by Xu Ning's avatar Xu Ning Committed by Owen Yamauchi

make folly:make_unique support customized deleter

Summary: just follow the same template arguments as unique_ptr

Test Plan: compile

Reviewed By: marcelo.juchem@fb.com

FB internal diff: D825025
parent 5c507b28
...@@ -34,11 +34,12 @@ namespace folly { ...@@ -34,11 +34,12 @@ namespace folly {
* we have std::make_unique(). * we have std::make_unique().
* *
* @author Louis Brandy (ldbrandy@fb.com) * @author Louis Brandy (ldbrandy@fb.com)
* @author Xu Ning (xning@fb.com)
*/ */
template<typename T, typename... Args> template<typename T, typename Dp = std::default_delete<T>, typename... Args>
std::unique_ptr<T> make_unique(Args&&... args) { std::unique_ptr<T, Dp> make_unique(Args&&... args) {
return std::unique_ptr<T>(new T(std::forward<Args>(args)...)); return std::unique_ptr<T, Dp>(new T(std::forward<Args>(args)...));
} }
/** /**
......
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