kokkos-execution 0.0.1
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
11
19template <std::size_t N>
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
47template <typename T>
48constexpr bool is_fixed_string_v = false;
49
50template <std::size_t N>
51constexpr bool is_fixed_string_v<FixedString<N>> = true;
52
53} // namespace Kokkos::Execution::Impl
54
55#endif // KOKKOS_EXECUTION_IMPL_FIXED_STRING_HPP
constexpr bool is_fixed_string_v
constexpr auto size() const noexcept
constexpr auto begin() const noexcept
constexpr auto view() const noexcept(noexcept(std::string_view{data, size()})) -> decltype(std::string_view{data, size()})
constexpr auto end() const noexcept
constexpr operator std::string_view() const noexcept(noexcept(view()))
constexpr FixedString(const char(&str)[N]) noexcept