From eb51ed9ae864001d16c659150d87aec72fb25333 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Tue, 17 Jan 2023 17:36:15 -0500 Subject: [PATCH] Shift ownership of initial values. --- Numeric/NumericCoder.hpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Numeric/NumericCoder.hpp b/Numeric/NumericCoder.hpp index a473eaa2f..ab8d48ad8 100644 --- a/Numeric/NumericCoder.hpp +++ b/Numeric/NumericCoder.hpp @@ -23,19 +23,20 @@ template class NumericCoder { /// Modifies @c target to hold @c value at @c index. template static void encode(int &target, int value) { static_assert(index < sizeof...(Sizes), "Index must be within range"); - NumericEncoder::template encode(target, value); + NumericEncoder::template encode(target, value); } + /// @returns The value from @c source at @c index. template static int decode(int source) { static_assert(index < sizeof...(Sizes), "Index must be within range"); - return NumericDecoder::template decode(source); + return NumericDecoder::template decode(source); } private: template struct NumericEncoder { - template static void encode(int &target, int value) { + template static void encode(int &target, int value) { if constexpr (i == index) { const int suffix = target % divider; target /= divider; @@ -51,7 +52,7 @@ template class NumericCoder { template struct NumericDecoder { - template static int decode(int source) { + template static int decode(int source) { if constexpr (i == index) { return (source / divider) % size; } else {