VapourSynth-llvmexpr
Loading...
Searching...
No Matches
FixedString.hpp
Go to the documentation of this file.
1
19
20#ifndef LLVMEXPR_UTILS_FIXEDSTRING_HPP
21#define LLVMEXPR_UTILS_FIXEDSTRING_HPP
22
23#include <algorithm>
24#include <array>
25#include <cstddef>
26#include <string_view>
27
28template <std::size_t N> struct FixedString {
29 std::array<char, N> value;
30
31 // NOLINTNEXTLINE(modernize-avoid-c-arrays,cppcoreguidelines-avoid-c-arrays)
32 explicit constexpr FixedString(const char (&str)[N]) {
33 std::ranges::copy(str, value.begin());
34 }
35
36 [[nodiscard]] constexpr std::string_view view() const {
37 return {value.data(), N - 1};
38 }
39};
40
41#endif // LLVMEXPR_UTILS_FIXEDSTRING_HPP
std::array< char, N > value
constexpr std::string_view view() const
constexpr FixedString(const char(&str)[N])