// // SSX 3 Lobby Server // // (C) 2021-2022 modeco80 // // This file is licensed under the GNU General Public License Version 3. // Text is provided in LICENSE. // #ifndef EUROPA_UTIL_FIXEDSTRING_H #define EUROPA_UTIL_FIXEDSTRING_H #include namespace europa::util { template struct FixedString { char buf[N + 1]{}; constexpr FixedString(const char* s) { // NOLINT for (unsigned i = 0; i != N; ++i) buf[i] = s[i]; } constexpr operator const char*() const { // NOLINT return buf; } [[nodiscard]] constexpr std::size_t Length() const { return N; } }; template FixedString(char const (&)[N]) -> FixedString; } #endif // EUROPA_UTIL_FIXEDSTRING_H