]> git.saurik.com Git - apple/system_cmds.git/blob - CPPUtil/UtilMakeUnique.hpp
0be557c3a74a7f0084d3d6aaaf9b9e31d22ef6ca
[apple/system_cmds.git] / CPPUtil / UtilMakeUnique.hpp
1 //
2 // UtilMakeUnique.hpp
3 // CPPUtil
4 //
5 // Created by James McIlree on 4/15/13.
6 // Copyright (c) 2013 Apple. All rights reserved.
7 //
8
9 #ifndef CPPUtil_UtilMakeUnique_hpp
10 #define CPPUtil_UtilMakeUnique_hpp
11
12 /* Not needed in C++14 or later */
13 #if __cplusplus <= 201103
14
15 template<typename T, typename ...Args>
16 std::unique_ptr<T> make_unique( Args&& ...args )
17 {
18 return std::unique_ptr<T>( new T( std::forward<Args>(args)... ) );
19 }
20
21 #endif
22
23 #endif