summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/libcamera/include/utils.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/libcamera/include/utils.h b/src/libcamera/include/utils.h
index 3ffa6f4e..a2e450b3 100644
--- a/src/libcamera/include/utils.h
+++ b/src/libcamera/include/utils.h
@@ -7,6 +7,19 @@
#ifndef __LIBCAMERA_UTILS_H__
#define __LIBCAMERA_UTILS_H__
+#include <memory>
+
#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))
+namespace libcamera::utils {
+
+/* C++11 doesn't provide std::make_unique */
+template<typename T, typename... Args>
+std::unique_ptr<T> make_unique(Args&&... args)
+{
+ return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
+}
+
+} /* namespace libcamera::utils */
+
#endif /* __LIBCAMERA_UTILS_H__ */