cpp-common/bt2c/fmt.hpp: use `wise_enum::string_type` in `EnableIfIsWiseEnum` definition
[babeltrace.git] / src / cpp-common / bt2s / make-unique.hpp
1 /*
2 * Copyright (c) 2022 Philippe Proulx <pproulx@efficios.com>
3 *
4 * SPDX-License-Identifier: MIT
5 */
6
7 #ifndef BABELTRACE_CPP_COMMON_BT2S_MAKE_UNIQUE_HPP
8 #define BABELTRACE_CPP_COMMON_BT2S_MAKE_UNIQUE_HPP
9
10 #include <memory>
11 #include <type_traits>
12 #include <utility>
13
14 namespace bt2s {
15
16 /*
17 * Our implementation of std::make_unique<>() for C++11.
18 */
19 template <typename T, typename... ArgTs>
20 std::unique_ptr<T> make_unique(ArgTs&&...args)
21 {
22 static_assert(!std::is_array<T>::value, "`T` is not an array (unsupported).");
23
24 return std::unique_ptr<T>(new T {std::forward<ArgTs>(args)...});
25 }
26
27 } /* namespace bt2s */
28
29 #endif /* BABELTRACE_CPP_COMMON_BT2S_MAKE_UNIQUE_HPP */
This page took 0.030124 seconds and 4 git commands to generate.