From 85398a9410a3ab36786c1e436986309ee6163f2f Mon Sep 17 00:00:00 2001 From: "Claudius \"keldu\" Holeksa" Date: Sun, 11 Jun 2023 20:20:52 +0200 Subject: c++, codec-json: Added struct to json encoding and fixed a buffer bug on the fly --- src/core/error.cpp | 2 +- src/core/templates.h | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) (limited to 'src/core') diff --git a/src/core/error.cpp b/src/core/error.cpp index 9520972..e777c84 100644 --- a/src/core/error.cpp +++ b/src/core/error.cpp @@ -32,7 +32,7 @@ const std::string_view error::get_message() const { } bool error::failed() const { - return this->is_type(); + return !this->is_type(); } bool error::is_critical() const { diff --git a/src/core/templates.h b/src/core/templates.h index 6c0a74e..fcac61b 100644 --- a/src/core/templates.h +++ b/src/core/templates.h @@ -53,4 +53,21 @@ struct parameter_key_pack_index { "Provided string_literal doesn't exist in searched list"); }; +template +struct parameter_key_pack_type_helper { + static constexpr string_literal literal = parameter_key_pack_type_helper::literal; +}; + +template +struct parameter_key_pack_type_helper { + static constexpr string_literal literal = Key0; +}; + +template +struct parameter_key_pack_type { + static constexpr string_literal literal = parameter_key_pack_type_helper::literal; + + static_assert(i < sizeof...(Keys), "Provided index is too large in list"); +}; + } -- cgit v1.2.3