CBMC
make_unique.h
Go to the documentation of this file.
1 /*******************************************************************\
2 
3 Module: Really simple unique_ptr utilities
4 
5 Author: Reuben Thomas, reuben.thomas@diffblue.com
6 
7 \*******************************************************************/
8 
9 #ifndef CPROVER_UTIL_MAKE_UNIQUE_H
10 #define CPROVER_UTIL_MAKE_UNIQUE_H
11 
12 #include <memory> // unique_ptr
13 
14 // This is a stand-in for std::make_unique, which isn't part of the standard
15 // library until C++14. When we move to C++14, we should do a find-and-replace
16 // on this to use std::make_unique instead.
17 
18 template<typename T, typename... Ts>
19 std::unique_ptr<T> util_make_unique(Ts &&... ts)
20 {
21  return std::unique_ptr<T>(new T(std::forward<Ts>(ts)...));
22 }
23 
24 #endif
util_make_unique
std::unique_ptr< T > util_make_unique(Ts &&... ts)
Definition: make_unique.h:19