feat make_unique support T* ptr
This commit is contained in:
parent
9e85ebb784
commit
9bd627ea6c
@ -17,6 +17,12 @@ make_unique(Args &&...args) {
|
||||
return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
|
||||
}
|
||||
|
||||
template <typename T, typename... Args>
|
||||
inline enable_if_t<!std::is_array<T>::value, std::unique_ptr<T>>
|
||||
make_unique(T *ptr) {
|
||||
return std::unique_ptr<T>(ptr);
|
||||
}
|
||||
|
||||
// dynamic array
|
||||
template <typename T>
|
||||
inline enable_if_t<std::is_array<T>::value && std::extent<T>::value == 0,
|
||||
|
Loading…
Reference in New Issue
Block a user