sessiond: open_packets: use user_space_consumer_channel_keys util
[lttng-tools.git] / src / common / meta-helpers.hpp
1 /*
2 * Copyright (C) 2024 Jérémie Galarneau <jeremie.galarneau@efficios.com>
3 *
4 * SPDX-License-Identifier: LGPL-2.1-only
5 *
6 */
7
8 #ifndef LTTNG_META_HELPERS_HPP
9 #define LTTNG_META_HELPERS_HPP
10
11 #include <memory>
12
13 /*
14 * Collection of meta-programming helpers.
15 *
16 * @see type-traits.hpp
17 */
18 namespace lttng {
19 namespace memory {
20 template <typename WrappedType, void (*DeleterFunction)(WrappedType *)>
21 struct create_deleter_class {
22 struct deleter {
23 void operator()(WrappedType *instance) const
24 {
25 DeleterFunction(instance);
26 }
27 };
28
29 std::unique_ptr<WrappedType, deleter> operator()(WrappedType *instance) const
30 {
31 return std::unique_ptr<WrappedType, deleter>(instance);
32 }
33 };
34 } /* namespace memory */
35 } /* namespace lttng */
36
37 #endif /* LTTNG_META_HELPERS_HPP */
This page took 0.030956 seconds and 4 git commands to generate.