alpaka
Abstraction Library for Parallel Kernel Acceleration
Set.hpp
Go to the documentation of this file.
1
/* Copyright 2022 Benjamin Worpitz, Bernhard Manfred Gruber
2
* SPDX-License-Identifier: MPL-2.0
3
*/
4
5
#pragma once
6
7
#include <utility>
8
9
namespace
alpaka::meta
10
{
11
namespace
detail
12
{
13
//! Empty dependent type.
14
template
<
typename
T>
15
struct
Empty
16
{
17
};
18
19
template
<
typename
... Ts>
20
struct
IsParameterPackSetImpl
;
21
22
template
<>
23
struct
IsParameterPackSetImpl
<>
24
{
25
static
constexpr
bool
value =
true
;
26
};
27
28
// Based on code by Roland Bock: https://gist.github.com/rbock/ad8eedde80c060132a18
29
// Linearly inherits from empty<T> and checks if it has already inherited from this type.
30
template
<
typename
T,
typename
... Ts>
31
struct
IsParameterPackSetImpl
<T, Ts...>
32
:
public
IsParameterPackSetImpl
<Ts...>
33
,
public
virtual
Empty
<T>
34
{
35
using
Base
=
IsParameterPackSetImpl
<Ts...>;
36
37
static
constexpr
bool
value = Base::value && !std::is_base_of_v<Empty<T>,
Base
>;
38
};
39
}
// namespace detail
40
41
//! Trait that tells if the parameter pack contains only unique (no equal) types.
42
template
<
typename
... Ts>
43
using
IsParameterPackSet
=
detail::IsParameterPackSetImpl
<Ts...>;
44
45
namespace
detail
46
{
47
template
<
typename
TList>
48
struct
IsSetImpl
;
49
50
template
<
template
<
typename
...>
class
TList,
typename
... Ts>
51
struct
IsSetImpl
<TList<Ts...>>
52
{
53
static
constexpr
bool
value =
IsParameterPackSet
<Ts...>::value;
54
};
55
}
// namespace detail
56
57
//! Trait that tells if the template contains only unique (no equal) types.
58
template
<
typename
TList>
59
using
IsSet
=
detail::IsSetImpl<TList>
;
60
}
// namespace alpaka::meta
alpaka::meta
Definition:
Apply.hpp:8
alpaka::meta::detail::Empty
Empty dependent type.
Definition:
Set.hpp:16
alpaka::meta::detail::IsParameterPackSetImpl
Definition:
Set.hpp:20
alpaka::meta::detail::IsSetImpl
Definition:
Set.hpp:48
include
alpaka
meta
Set.hpp
Generated on Thu Dec 12 2024 11:51:45 for alpaka by
1.9.1