kokkos-execution
0.0.1
Toggle main menu visibility
Loading...
Searching...
No Matches
matching_completion_signature.hpp
Go to the documentation of this file.
1
// NOLINTBEGIN
2
/*
3
* SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
4
* Copyright (c) 2026 Robert Leahy. All rights reserved.
5
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
*
7
* Licensed under the Apache License, Version 2.0 with LLVM Exceptions (the "License");
8
* you may not use this file except in compliance with the License.
9
* You may obtain a copy of the License at
10
*
11
* https://llvm.org/LICENSE.txt
12
*
13
* Unless required by applicable law or agreed to in writing, software
14
* distributed under the License is distributed on an "AS IS" BASIS,
15
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
* See the License for the specific language governing permissions and
17
* limitations under the License.
18
*/
19
20
#pragma once
21
22
#include "stdexec/execution.hpp"
23
24
#include <cstddef>
25
#include <type_traits>
26
27
namespace
experimental::execution
{
28
29
namespace
detail::matching_completion_signature
{
30
31
template
<
typename
>
32
struct
canonicalize
;
33
34
template
<
typename
Tag,
typename
... Args>
35
struct
canonicalize
<Tag(Args...)> {
36
using
type
= Tag(Args&&...);
37
};
38
39
template
<
typename
Signature>
40
using
canonicalize_t
=
typename
canonicalize<Signature>::type
;
41
42
template
<
typename
Needle,
typename
Signature>
43
inline
constexpr
bool
is_canonical_match
= std::is_same_v<canonicalize_t<Needle>,
canonicalize_t<Signature>
>;
44
45
template
<
typename
Needle,
typename
Signatures>
46
struct
canonical_match_count
;
47
48
template
<
typename
Needle,
typename
... Signatures>
49
struct
canonical_match_count
<Needle, ::STDEXEC::completion_signatures<Signatures...>>
50
: std::integral_constant<std::size_t, (is_canonical_match<Needle, Signatures> + ... + 0)> { };
51
52
template
<
typename
Needle,
typename
... Signatures>
53
struct
find_canonical_match
;
54
55
template
<
typename
Needle>
56
struct
find_canonical_match
<Needle> { };
57
58
template
<
typename
Needle,
typename
Signature,
typename
... Rest>
59
struct
find_canonical_match
<Needle, Signature, Rest...>
60
: std::conditional_t<
61
is_canonical_match<Needle, Signature>,
62
std::type_identity<Signature>,
63
find_canonical_match<Needle, Rest...>
64
> { };
65
66
template
<
67
typename
Signatures,
68
typename
Signature,
69
std::size_t Matches =
canonical_match_count<Signature, Signatures>::value
70
>
71
struct
matching_completion_signature
{ };
72
73
template
<
typename
Signature,
typename
... Signatures>
74
struct
matching_completion_signature
<::STDEXEC::completion_signatures<Signatures...>, Signature, 1>
75
:
find_canonical_match
<Signature, Signatures...> { };
76
77
}
// namespace detail::matching_completion_signature
78
79
template
<
typename
Signatures,
typename
Tag,
typename
... Args>
80
using
matching_completion_signature_t
=
81
typename
detail::matching_completion_signature::matching_completion_signature
<Signatures, Tag(Args...)>::type;
82
83
template
<
typename
Signatures,
typename
Tag,
typename
... Args>
84
inline
constexpr
bool
has_matching_completion_signature_v
=
requires
{
85
typename
matching_completion_signature_t
<Signatures, Tag, Args...>;
86
};
87
88
template
<
typename
Signatures,
typename
Tag,
typename
... Args>
89
struct
matching_completion_signature
{
90
using
type
=
matching_completion_signature_t
<Signatures, Tag, Args...>;
91
};
92
93
template
<
typename
Signatures,
typename
Tag,
typename
... Args>
94
struct
has_matching_completion_signature
95
: std::bool_constant<has_matching_completion_signature_v<Signatures, Tag, Args...>> { };
96
97
}
// namespace experimental::execution
98
99
// NOLINTEND
experimental::execution::detail::matching_completion_signature
Definition
matching_completion_signature.hpp:29
experimental::execution::detail::matching_completion_signature::canonicalize_t
typename canonicalize< Signature >::type canonicalize_t
Definition
matching_completion_signature.hpp:40
experimental::execution::detail::matching_completion_signature::is_canonical_match
constexpr bool is_canonical_match
Definition
matching_completion_signature.hpp:43
experimental::execution
Definition
elide.hpp:28
experimental::execution::matching_completion_signature_t
typename detail::matching_completion_signature::matching_completion_signature< Signatures, Tag(Args...)>::type matching_completion_signature_t
Definition
matching_completion_signature.hpp:80
experimental::execution::has_matching_completion_signature_v
constexpr bool has_matching_completion_signature_v
Definition
matching_completion_signature.hpp:84
experimental::execution::detail::matching_completion_signature::canonical_match_count
Definition
matching_completion_signature.hpp:46
experimental::execution::detail::matching_completion_signature::canonicalize< Tag(Args...)>::type
Tag(Args &&...) type
Definition
matching_completion_signature.hpp:36
experimental::execution::detail::matching_completion_signature::canonicalize
Definition
matching_completion_signature.hpp:32
experimental::execution::detail::matching_completion_signature::find_canonical_match
Definition
matching_completion_signature.hpp:53
experimental::execution::detail::matching_completion_signature::matching_completion_signature
Definition
matching_completion_signature.hpp:71
experimental::execution::has_matching_completion_signature
Definition
matching_completion_signature.hpp:95
experimental::execution::matching_completion_signature
Definition
matching_completion_signature.hpp:89
experimental::execution::matching_completion_signature::type
matching_completion_signature_t< Signatures, Tag, Args... > type
Definition
matching_completion_signature.hpp:90
kokkos-execution
stdexec
P3955
matching_completion_signature.hpp
Generated on
for kokkos-execution by
1.18.0