kokkos-execution 0.0.1
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
10import kokkos.core;
11#else
12# include "Kokkos_Core.hpp"
13#endif
14
17
30
31namespace Kokkos::Execution {
32
33namespace Impl {
34
35template <typename T>
36struct Label;
37
39template <typename T>
40concept label = std::convertible_to<T, std::string> || stdexec::__is_instance_of<T, Label>;
41
43template <typename T>
44struct Label {
45 using type = T;
46
48};
49
52template <std::convertible_to<std::string> T>
54
55template <typename T>
58
59template <typename Data>
61
73template <typename T>
74requires std::convertible_to<T, std::string>
75constexpr auto as_convertible_to_string(T&& value) STDEXEC_AUTO_RETURN(std::forward<T>(value))
76
77template <typename T>
78requires(!std::convertible_to<T, std::string>)
79constexpr 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)
91consteval Impl::Label<std::string_view> label(std::string_view str) noexcept {
92 return {str};
93}
94#else
95consteval 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
Constrain the accepted label types.
Definition label.hpp:40
consteval bool has_property()
Return true when Data derives from the property Property.
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
Label(T) -> Label< std::string >
consteval Impl::Label< std::string_view > label(std::string_view str) noexcept
Definition label.hpp:91