cpp-common: rename bt2c::makeUnique() -> bt2s::make_unique()
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Wed, 15 Nov 2023 04:47:38 +0000 (23:47 -0500)
committerSimon Marchi <simon.marchi@efficios.com>
Thu, 14 Dec 2023 15:57:04 +0000 (10:57 -0500)
I now want everything mimicking the STL stuff to have the same names,
but I don't want to mix coding styles in `bt2c`.

Therefore introduce this new `bt2s` (the `s` stands for `std`) namespace
to contain everything acting as the STL (or Boost, if need be).

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: Ie24c11170cc650028f3ce50fcab2004f0195c12f
Reviewed-on: https://review.lttng.org/c/babeltrace/+/11393
CI-Build: Simon Marchi <simon.marchi@efficios.com>
Reviewed-by: Simon Marchi <simon.marchi@efficios.com>
Tested-by: jenkins <jenkins@lttng.org>
src/Makefile.am
src/cpp-common/bt2c/make-unique.hpp [deleted file]
src/cpp-common/bt2s/make-unique.hpp [new file with mode: 0644]

index b5d24fe1c91113a4d0d6c1d31b2521cee0439bcb..9f4796e4d252446f5b638a05b969c3fd4f4af0f5 100644 (file)
@@ -47,13 +47,13 @@ noinst_HEADERS = \
        cpp-common/bt2c/glib-up.hpp \
        cpp-common/bt2c/lib-str.hpp \
        cpp-common/bt2c/libc-up.hpp \
-       cpp-common/bt2c/make-unique.hpp \
        cpp-common/bt2c/read-fixed-len-int.hpp \
        cpp-common/bt2c/safe-ops.hpp \
        cpp-common/bt2c/std-int.hpp \
        cpp-common/bt2c/uuid-view.hpp \
        cpp-common/bt2c/uuid.hpp \
        cpp-common/bt2c/vector.hpp \
+       cpp-common/bt2s/make-unique.hpp \
        cpp-common/nlohmann/json.hpp \
        cpp-common/optional.hpp \
        cpp-common/string_view.hpp
diff --git a/src/cpp-common/bt2c/make-unique.hpp b/src/cpp-common/bt2c/make-unique.hpp
deleted file mode 100644 (file)
index 95f5534..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright (c) 2022 Philippe Proulx <pproulx@efficios.com>
- *
- * SPDX-License-Identifier: MIT
- */
-
-#ifndef BABELTRACE_CPP_COMMON_BT2C_MAKE_UNIQUE_HPP
-#define BABELTRACE_CPP_COMMON_BT2C_MAKE_UNIQUE_HPP
-
-#include <memory>
-#include <type_traits>
-#include <utility>
-
-namespace bt2c {
-
-/*
- * Our implementation of std::make_unique<>() for C++11.
- */
-template <typename T, typename... ArgTs>
-std::unique_ptr<T> makeUnique(ArgTs&&...args)
-{
-    static_assert(!std::is_array<T>::value, "`T` is not an array (unsupported).");
-
-    return std::unique_ptr<T>(new T {std::forward<ArgTs>(args)...});
-}
-
-} /* namespace bt2c */
-
-#endif /* BABELTRACE_CPP_COMMON_BT2C_MAKE_UNIQUE_HPP */
diff --git a/src/cpp-common/bt2s/make-unique.hpp b/src/cpp-common/bt2s/make-unique.hpp
new file mode 100644 (file)
index 0000000..6c4d1bf
--- /dev/null
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2022 Philippe Proulx <pproulx@efficios.com>
+ *
+ * SPDX-License-Identifier: MIT
+ */
+
+#ifndef BABELTRACE_CPP_COMMON_BT2S_MAKE_UNIQUE_HPP
+#define BABELTRACE_CPP_COMMON_BT2S_MAKE_UNIQUE_HPP
+
+#include <memory>
+#include <type_traits>
+#include <utility>
+
+namespace bt2s {
+
+/*
+ * Our implementation of std::make_unique<>() for C++11.
+ */
+template <typename T, typename... ArgTs>
+std::unique_ptr<T> make_unique(ArgTs&&...args)
+{
+    static_assert(!std::is_array<T>::value, "`T` is not an array (unsupported).");
+
+    return std::unique_ptr<T>(new T {std::forward<ArgTs>(args)...});
+}
+
+} /* namespace bt2s */
+
+#endif /* BABELTRACE_CPP_COMMON_BT2S_MAKE_UNIQUE_HPP */
This page took 0.026165 seconds and 4 git commands to generate.