make_unique
This commit is contained in:
parent
11866bf3ba
commit
de1c396a5e
@ -4,6 +4,7 @@
|
||||
#pragma once
|
||||
|
||||
#if ( __cplusplus >= 201103L )
|
||||
#include <memory>
|
||||
#include <type_traits>
|
||||
#endif
|
||||
|
||||
@ -15,6 +16,12 @@ namespace std
|
||||
template< class T >
|
||||
using underlying_type_t = typename std::underlying_type< T >::type;
|
||||
|
||||
template<typename T, typename... Args>
|
||||
std::unique_ptr<T> make_unique(Args&&... args)
|
||||
{
|
||||
return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
|
||||
}
|
||||
|
||||
} // namespace std
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user