Inexor
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
make_unique.hpp
Go to the documentation of this file.
1 // Make a unique ptr without using new;
2 //
3 // Will be standard in C++14; supported by boost but only
4 // from 1.56 (ubuntu provides 1.55)
5 
6 #pragma once
7 
8 // TODO: Use Boost implementation
9 
10 #include <memory>
11 #include <utility>
12 
13 namespace inexor {
14 namespace compat {
15 
16 // https://stackoverflow.com/questions/17902405/how-to-implement-make-unique-function-in-c11
17 template<typename T, typename... Args>
18 std::unique_ptr<T> make_unique(Args&&... args) {
19  return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
20 }
21 
22 }
23 }
std::unique_ptr< T > make_unique(Args &&...args)
Definition: make_unique.hpp:18