diff --git a/include/nameof.hpp b/include/nameof.hpp index 649ca31..b25141d 100644 --- a/include/nameof.hpp +++ b/include/nameof.hpp @@ -232,15 +232,15 @@ struct static_string final { constexpr const char* data() const noexcept { return chars.data(); } - constexpr std::size_t size() const noexcept { return chars.size(); } + constexpr std::size_t size() const noexcept { return N; } constexpr operator std::string_view() const noexcept { return {data(), size()}; } private: template - constexpr static_string(std::string_view str, std::index_sequence) noexcept : chars{{str[I]...}} {} + constexpr static_string(std::string_view str, std::index_sequence) noexcept : chars{{str[I]..., '\0'}} {} - const std::array chars; + const std::array chars; }; template <>