From aa2ecacd2e477eb5748f060d33138e0c12c0634f Mon Sep 17 00:00:00 2001 From: "Claudius \"keldu\" Holeksa" Date: Mon, 27 Nov 2023 23:03:57 +0100 Subject: codec,core,tools: Adding dangling experimental changes --- c++/core/templates.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'c++/core/templates.h') diff --git a/c++/core/templates.h b/c++/core/templates.h index e2851a0..2eb0f7e 100644 --- a/c++/core/templates.h +++ b/c++/core/templates.h @@ -105,6 +105,8 @@ struct ct_multiply { namespace impl { 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', @@ -119,18 +121,21 @@ template struct ct_convert_digits_helper { static constexpr size_t size = ct_convert_digits_helper::size; static constexpr std::array value = ct_convert_digits_helper::value; + static constexpr string_literal literal = ct_convert_digits_helper::literal; }; 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'}}; }; template struct ct_convert_digits_helper<0, Base> { static constexpr size_t size = 0; static constexpr std::array value = {0}; + static constexpr string_literal literal = "0"_sl; }; } @@ -140,5 +145,6 @@ struct ct_convert_to_digits { static constexpr size_t size = impl::ct_convert_digits_helper::size; static constexpr std::array value = impl::ct_convert_digits_helper::value; + static constexpr string_literal literal = impl::ct_convert_digits_helper::literal; }; } -- cgit v1.2.3