// Copyright 2024 The DMBMX2Tools Authors // SPDX-License-Identifier: MIT #pragma once #include #include namespace dmtools { /// A compile-time string. Usable as a C++20 cNTTP. template struct FixedString { char buf[N + 1] {}; constexpr FixedString(const char* s) { for(usize i = 0; i != N; ++i) buf[i] = s[i]; } constexpr operator const char*() const { return buf; } constexpr operator std::string_view() const { return { buf, N }; } [[nodiscard]] constexpr usize Length() const { return N; } }; template FixedString(char const (&)[N]) -> FixedString; } // namespace ssxtools::core