From 2e419a4380bb1108186e9664052a510770e98de6 Mon Sep 17 00:00:00 2001 From: Spartan322 Date: Thu, 8 Oct 2026 07:50:39 -0400 Subject: [PATCH] Add consteval string_view constructor to string_literal This enables us to remove the duplicate StringLiteral type in the OpenVic repo for the simulation's string_literal type. --- src/openvic-simulation/core/string/StringLiteral.hpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/openvic-simulation/core/string/StringLiteral.hpp b/src/openvic-simulation/core/string/StringLiteral.hpp index 8b5c1687e..300da1bc6 100644 --- a/src/openvic-simulation/core/string/StringLiteral.hpp +++ b/src/openvic-simulation/core/string/StringLiteral.hpp @@ -57,6 +57,13 @@ namespace OpenVic { } } + [[nodiscard]] consteval string_literal(std::string_view string) { + if (string.size() != N) { + unreachable(); + } + std::copy_n(string.begin(), N, _data); + } + [[nodiscard]] constexpr string_literal(value_type c) noexcept { _data[0] = c; _data[size()] = '\0';