VIPRA Documentation
Loading...
Searching...
No Matches
include
vipra
util
all_of_type.hpp
1
#pragma once
2
3
#include <tuple>
4
#include <type_traits>
5
#include <utility>
6
#include "vipra/util/get_nth_value.hpp"
7
8
namespace
VIPRA::Util {
9
// NOLINTBEGIN(readability-identifier-naming) utility type
10
template
<
typename
... type_ts>
11
struct
all_of_type
{};
12
13
template
<
typename
type_t>
14
struct
all_of_type
<type_t> {
15
static
constexpr
bool
value =
true
;
16
};
17
18
template
<
typename
check_type_t,
typename
head_t,
typename
... tail_ts>
19
struct
all_of_type
<check_type_t, head_t, tail_ts...> {
20
static
constexpr
bool
value =
21
std::is_same_v<check_type_t, head_t> &&
all_of_type
<head_t, tail_ts...>::value;
22
};
23
24
template
<
typename
check_type_t,
typename
... type_ts>
25
struct
all_of_type
<check_type_t, std::tuple<type_ts...>> {
26
static
constexpr
bool
value =
27
std::is_same_v<check_type_t, std::tuple_element<0, std::tuple<type_ts...>>> &&
28
all_of_type
<std::tuple_element<0, std::tuple<type_ts...>>, type_ts...>::value;
29
};
30
36
template
<
typename
... type_ts>
37
inline
constexpr
bool
all_of_type_v =
all_of_type
<type_ts...>::value;
38
// NOLINTEND(readability-identifier-naming)
39
}
// namespace VIPRA::Util
VIPRA::Util::all_of_type
Definition
all_of_type.hpp:11
Generated by
1.13.2