From 57d7178e76b41c5d0f8117fc8fb5791b4108cdc0 Mon Sep 17 00:00:00 2001 From: Green Sky Date: Fri, 1 Dec 2023 19:21:09 +0100 Subject: [PATCH] dont include the null byte --- solanaceae/util/config_model.inl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/solanaceae/util/config_model.inl b/solanaceae/util/config_model.inl index 4efe6a7..ed41c80 100644 --- a/solanaceae/util/config_model.inl +++ b/solanaceae/util/config_model.inl @@ -6,14 +6,14 @@ #include #include -struct CM_InternalStringView { +struct CM_InternalStringView final { const char* start {nullptr}; uint64_t extend {0}; // conversion helpers CM_InternalStringView(const std::string_view sv) : start(sv.data()), extend(sv.size()) {} template - CM_InternalStringView(const char (&str)[N]) : start(str), extend(N) {} + CM_InternalStringView(const char (&str)[N]) : start(str), extend(N-1u) {} CM_InternalStringView(const std::string& str) : start(str.data()), extend(str.size()) {} operator std::string() { return {start, start+extend}; } operator std::string_view() { return {start, extend}; }