kokkos-execution
0.0.1
Toggle main menu visibility
Loading...
Searching...
No Matches
fixed_string.hpp
Go to the documentation of this file.
1
#ifndef KOKKOS_EXECUTION_IMPL_FIXED_STRING_HPP
2
#define KOKKOS_EXECUTION_IMPL_FIXED_STRING_HPP
3
4
#include <algorithm>
5
#include <cstddef>
6
#include <string_view>
7
8
#include "stdexec/__detail/__config.hpp"
9
10
namespace
Kokkos::Execution::Impl
{
11
19
template
<std::
size_t
N>
20
struct
FixedString
{
21
char
data
[N]{};
22
23
constexpr
FixedString
(
const
char
(&str)[N])
noexcept
{
// NOLINT(google-explicit-constructor)
24
std::ranges::copy(str,
data
);
25
}
26
27
constexpr
auto
size
() const noexcept {
28
return
N - 1;
29
}
30
31
constexpr
auto
begin
() const noexcept {
32
return
data
;
33
}
34
35
constexpr
auto
end
() const noexcept {
36
return
data
+ N - 1;
37
}
38
39
constexpr
operator
std::string_view() const noexcept(noexcept(
view
())) {
// NOLINT(google-explicit-constructor)
40
return
view
();
41
}
42
43
[[nodiscard]]
44
constexpr
auto
view
() const STDEXEC_AUTO_RETURN(std::
string_view
{
data
,
size
()})
45
};
46
47
template
<
typename
T>
48
constexpr
bool
is_fixed_string_v
=
false
;
49
50
template
<std::
size_t
N>
51
constexpr
bool
is_fixed_string_v<FixedString<N>
> =
true
;
52
53
}
// namespace Kokkos::Execution::Impl
54
55
#endif
// KOKKOS_EXECUTION_IMPL_FIXED_STRING_HPP
Kokkos::Execution::Impl
Definition
attributes.hpp:6
Kokkos::Execution::Impl::is_fixed_string_v
constexpr bool is_fixed_string_v
Definition
fixed_string.hpp:48
Kokkos::Execution::Impl::FixedString::size
constexpr auto size() const noexcept
Definition
fixed_string.hpp:27
Kokkos::Execution::Impl::FixedString::begin
constexpr auto begin() const noexcept
Definition
fixed_string.hpp:31
Kokkos::Execution::Impl::FixedString::view
constexpr auto view() const noexcept(noexcept(std::string_view{data, size()})) -> decltype(std::string_view{data, size()})
Definition
fixed_string.hpp:44
Kokkos::Execution::Impl::FixedString::end
constexpr auto end() const noexcept
Definition
fixed_string.hpp:35
Kokkos::Execution::Impl::FixedString::string_view
constexpr operator std::string_view() const noexcept(noexcept(view()))
Definition
fixed_string.hpp:39
Kokkos::Execution::Impl::FixedString::FixedString
constexpr FixedString(const char(&str)[N]) noexcept
Definition
fixed_string.hpp:23
Kokkos::Execution::Impl::FixedString::data
char data[N]
Definition
fixed_string.hpp:21
kokkos-execution
impl
fixed_string.hpp
Generated on
for kokkos-execution by
1.18.0