summaryrefslogtreecommitdiff
path: root/src/make_unique.hh
diff options
context:
space:
mode:
authorJoel Klinghed <the_jk@opera.com>2017-10-31 15:01:57 +0100
committerJoel Klinghed <the_jk@opera.com>2017-10-31 15:01:57 +0100
commit38140372d8c8dd32267943d5d79b2ce2c0a032fb (patch)
tree0e2555e591092f934e05451ef4a6df18c5ddc739 /src/make_unique.hh
parent2e5352a1128da3ff4637561788a7da8e6b24ab9c (diff)
Use std::make_unique
Diffstat (limited to 'src/make_unique.hh')
-rw-r--r--src/make_unique.hh15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/make_unique.hh b/src/make_unique.hh
new file mode 100644
index 0000000..c5a1bbc
--- /dev/null
+++ b/src/make_unique.hh
@@ -0,0 +1,15 @@
+#ifndef MAKE_UNIQUE_HH
+#define MAKE_UNIQUE_HH
+
+#include <memory>
+
+namespace std {
+
+template<typename T, typename... Args>
+inline std::unique_ptr<T> make_unique(Args&&... args) {
+ return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
+}
+
+} // namespace std
+
+#endif // MAKE_UNIQUE_HH