kokkos-execution
0.0.1
Toggle main menu visibility
Loading...
Searching...
No Matches
label.hpp
Go to the documentation of this file.
1
#ifndef KOKKOS_EXECUTION_IMPL_LABEL_HPP
2
#define KOKKOS_EXECUTION_IMPL_LABEL_HPP
3
4
#if defined(__cpp_impl_reflection)
5
# include <meta>
6
#endif
7
8
#include "Kokkos_Macros.hpp"
9
#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES
10
import
kokkos.core;
11
#else
12
# include "Kokkos_Core.hpp"
13
#endif
14
15
#include "
kokkos-execution/impl/fixed_string.hpp
"
16
#include "
kokkos-execution/impl/properties.hpp
"
17
30
31
namespace
Kokkos::Execution
{
32
33
namespace
Impl
{
34
35
template
<
typename
T>
36
struct
Label
;
37
39
template
<
typename
T>
40
concept
label
= std::convertible_to<T, std::string> || stdexec::__is_instance_of<T, Label>;
41
43
template
<
typename
T>
44
struct
Label
{
45
using
type
= T;
46
47
T
m_value
;
48
};
49
52
template
<std::convertible_to<std::
string
> T>
53
Label
(T) ->
Label<std::string>
;
54
55
template
<
typename
T>
56
Label
(T) ->
Label<T>
;
58
59
template
<
typename
Data>
60
concept
labeled
=
has_property<Data, Label>
();
61
73
template
<
typename
T>
74
requires
std::convertible_to<T, std::string>
75
constexpr
auto
as_convertible_to_string
(T&& value) STDEXEC_AUTO_RETURN(std::forward<T>(value))
76
77
template
<
typename
T>
78
requires
(!std::convertible_to<T, std::string>)
79
constexpr
auto
as_convertible_to_string
(T&& value) STDEXEC_AUTO_RETURN(
static_cast<
std::string
>
(std::forward<T>(value)))
80
81
}
// namespace Impl
82
90
#if !defined(__cpp_lib_define_static)
91
consteval
Impl::Label<std::string_view>
label
(std::string_view str)
noexcept
{
92
return
{str};
93
}
94
#else
95
consteval
Impl::Label<std::string_view>
label
(std::string_view str)
noexcept
{
96
return
{std::define_static_string(std::move(str))};
97
}
98
#endif
100
101
}
// namespace Kokkos::Execution
102
103
#endif
// KOKKOS_EXECUTION_IMPL_LABEL_HPP
Kokkos::Execution::Impl::label
Constrain the accepted label types.
Definition
label.hpp:40
Kokkos::Execution::Impl::labeled
Definition
label.hpp:60
fixed_string.hpp
properties.hpp
Kokkos::Execution::Impl
Definition
attributes.hpp:6
Kokkos::Execution::Impl::has_property
consteval bool has_property()
Return true when Data derives from the property Property.
Definition
properties.hpp:68
Kokkos::Execution::Impl::as_convertible_to_string
constexpr auto as_convertible_to_string(T &&value) noexcept(noexcept(std::forward< T >(value))) -> decltype(std::forward< T >(value))
Convert to a value usable as a std::string.
Definition
label.hpp:75
Kokkos::Execution::Impl::Label
Label(T) -> Label< std::string >
Kokkos::Execution
Definition
execution_space.hpp:26
Kokkos::Execution::label
consteval Impl::Label< std::string_view > label(std::string_view str) noexcept
Definition
label.hpp:91
Kokkos::Execution::Impl::Label
Label property.
Definition
label.hpp:44
Kokkos::Execution::Impl::Label::type
T type
Definition
label.hpp:45
Kokkos::Execution::Impl::Label::m_value
T m_value
Definition
label.hpp:47
kokkos-execution
impl
label.hpp
Generated on
for kokkos-execution by
1.18.0