summaryrefslogtreecommitdiff
path: root/modules/core
diff options
context:
space:
mode:
authorClaudius "keldu" Holeksa <mail@keldu.de>2024-02-16 15:50:40 +0100
committerClaudius "keldu" Holeksa <mail@keldu.de>2024-02-16 15:50:40 +0100
commit35635f5514a9f702b5606146bf9ff4494030ff8f (patch)
treee106742b502e93053943aaccd85040147a28c3de /modules/core
parentda93f0466cdeaf266debe5bacee6779354cf4a34 (diff)
core,tools,codec: Moving towards lang tooling
Diffstat (limited to 'modules/core')
-rw-r--r--modules/core/c++/string_literal.hpp2
-rw-r--r--modules/core/c++/templates.hpp12
2 files changed, 9 insertions, 5 deletions
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<CharT, N+NR-1>{sum};
}
+
+
};
template <typename T, T... Chars>
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<T, V0, VN...> {
};
namespace impl {
-template<typename T, size_t i>
+template<typename T>
struct ct_convert_digits_table_helper {
- static_assert(i <= 15, "Only conversion up to hex is supported");
-
static constexpr std::array<T, 16> 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<uint64_t i>
+ static constexpr T value(){
+ static_assert(i < 16, "Only conversion up to hex is supported");
+ return table[i];
+ };
};
template<uint64_t Num, uint64_t Base, uint64_t... Digs>
@@ -128,7 +130,7 @@ template<uint64_t Base, uint64_t... Digs>
struct ct_convert_digits_helper<0, Base, Digs...> {
static constexpr size_t size = sizeof...(Digs);
static constexpr std::array<uint64_t, size> value = {Digs...};
- static constexpr string_literal literal = {{ct_convert_digits_table_helper<char, Digs>::value..., '\0'}};
+ static constexpr string_literal literal = {{ct_convert_digits_table_helper<char>::value<Digs>()..., '\0'}};
};
template<uint64_t Base>