summaryrefslogtreecommitdiff
path: root/libs/cpp14/include/cpp14/memory.h
diff options
context:
space:
mode:
Diffstat (limited to 'libs/cpp14/include/cpp14/memory.h')
-rw-r--r--libs/cpp14/include/cpp14/memory.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/libs/cpp14/include/cpp14/memory.h b/libs/cpp14/include/cpp14/memory.h
new file mode 100644
index 000000000..b3e678baa
--- /dev/null
+++ b/libs/cpp14/include/cpp14/memory.h
@@ -0,0 +1,29 @@
+/**
+ * @file memory.h
+ * @ingroup COM_AI_RUNTIME
+ * @brief This file contains @c make_unique which is not supported by C++11
+ */
+#ifndef __NNFW_CPP14_MEMORY_H__
+#define __NNFW_CPP14_MEMORY_H__
+
+#include <memory>
+
+namespace nnfw
+{
+namespace cpp14
+{
+/**
+ * @brief Provide @c make_unique function supported from C++14
+ * @param[in] args List of arguments with which an instance of T will be constructed.
+ * @return @c std::unique_ptr of an instance of type T
+ */
+template <typename T, typename... Args> std::unique_ptr<T> make_unique(Args &&... args)
+{
+ // NOTE std::make_unique is missing in C++11 standard
+ return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
+}
+
+} // napesapce cpp14
+} // namespace nnfw
+
+#endif // __NNFW_CPP14_MEMORY_H__