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