From 35635f5514a9f702b5606146bf9ff4494030ff8f Mon Sep 17 00:00:00 2001 From: "Claudius \"keldu\" Holeksa" Date: Fri, 16 Feb 2024 15:50:40 +0100 Subject: core,tools,codec: Moving towards lang tooling --- modules/core/c++/string_literal.hpp | 2 ++ modules/core/c++/templates.hpp | 12 +++++++----- 2 files changed, 9 insertions(+), 5 deletions(-) (limited to 'modules/core') diff --git a/modules/core/c++/string_literal.hpp b/modules/core/c++/string_literal.hpp index ccc8f49..5fed55e 100644 --- a/modules/core/c++/string_literal.hpp +++ b/modules/core/c++/string_literal.hpp @@ -48,6 +48,8 @@ public: return string_literal{sum}; } + + }; template diff --git a/modules/core/c++/templates.hpp b/modules/core/c++/templates.hpp index a448911..05b5a56 100644 --- a/modules/core/c++/templates.hpp +++ b/modules/core/c++/templates.hpp @@ -103,10 +103,8 @@ struct ct_multiply { }; namespace impl { -template +template struct ct_convert_digits_table_helper { - static_assert(i <= 15, "Only conversion up to hex is supported"); - static constexpr std::array table = { '0', '1', '2', '3', '4', '5', '6', '7', @@ -114,7 +112,11 @@ struct ct_convert_digits_table_helper { 'C', 'D', 'E', 'F' }; - static constexpr T value = table[i]; + template + static constexpr T value(){ + static_assert(i < 16, "Only conversion up to hex is supported"); + return table[i]; + }; }; template @@ -128,7 +130,7 @@ template struct ct_convert_digits_helper<0, Base, Digs...> { static constexpr size_t size = sizeof...(Digs); static constexpr std::array value = {Digs...}; - static constexpr string_literal literal = {{ct_convert_digits_table_helper::value..., '\0'}}; + static constexpr string_literal literal = {{ct_convert_digits_table_helper::value()..., '\0'}}; }; template -- cgit v1.2.3