diff options
Diffstat (limited to 'modules/core')
-rw-r--r-- | modules/core/c++/string_literal.hpp | 2 | ||||
-rw-r--r-- | modules/core/c++/templates.hpp | 12 |
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> |