Add a make_unique implementation

This commit is contained in:
Danny Robson 2011-07-16 14:47:34 +10:00
parent ce747924ab
commit 64448e7e5e

View File

@ -6,6 +6,7 @@
#include <cstdint> #include <cstdint>
#include <string> #include <string>
#include <limits> #include <limits>
#include <memory>
template <int BITS> template <int BITS>
struct bits_type; struct bits_type;
@ -130,4 +131,11 @@ T hton (T);
template <typename T> template <typename T>
T ntoh (T); T ntoh (T);
template <typename T, typename ...Args>
std::unique_ptr<T>
make_unique (const Args &...args)
{ return std::unique_ptr<T> (new T (args...)); }
#endif // __TYPES_HPP #endif // __TYPES_HPP