Add an equivalent to std::make_unique introduced in C++14.
See https://herbsutter.com/gotw/_102/ for more details.
Change-Id: I67e5b54d883e311869d7c1272f9a2905dc349212
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
kernel-probe.cpp \
location.cpp \
log-level-rule.cpp \
+ make-unique.hpp \
make-unique-wrapper.hpp \
mi-lttng.cpp mi-lttng.hpp \
notification.cpp \
--- /dev/null
+/*
+ * Copyright (C) 2022 Jérémie Galarneau <jeremie.galarneau@efficios.com>
+ *
+ * SPDX-License-Identifier: LGPL-2.1-only
+ *
+ */
+
+#ifndef LTTNG_MAKE_UNIQUE_H
+#define LTTNG_MAKE_UNIQUE_H
+
+#include <memory>
+
+namespace lttng {
+
+template <typename Type, typename... Args>
+std::unique_ptr<Type> make_unique(Args&&...args)
+{
+ return std::unique_ptr<Type>(new Type(std::forward<Args>(args)...));
+}
+
+} /* namespace lttng */
+
+#endif /* LTTNG_MAKE_UNIQUE_H */