.gitignore: ignore local vscode workspace settings file
[lttng-tools.git] / src / common / type-traits.hpp
CommitLineData
a6df2497
JG
1/*
2 * Copyright (c) 2023 Philippe Proulx <pproulx@efficios.com>
3 *
4 * SPDX-License-Identifier: MIT
5 */
6
7#ifndef LTTNG_TYPE_TRAITS_HPP
8#define LTTNG_TYPE_TRAITS_HPP
9
10#include <type_traits>
11
12namespace lttng {
13namespace traits {
14
15/*
16 * Provides the member constant `value` equal to:
17 *
18 * `T` is in the list of types `Ts`:
19 * `true`
20 *
21 * Otherwise:
22 * `false`
23 */
24template <typename T, typename... Ts>
25struct is_one_of : std::false_type {
26};
27
28template <typename T, typename... Ts>
29struct is_one_of<T, T, Ts...> : std::true_type {
30};
31
32template <typename T, typename U, typename... Ts>
33struct is_one_of<T, U, Ts...> : is_one_of<T, Ts...> {
34};
35} /* namespace traits */
36} /* namespace lttng */
37
38#endif /* LTTNG_TYPE_TRAITS_HPP */
This page took 0.024109 seconds and 4 git commands to generate.