From 8ecfad7829cfa3b4342e41b9c52f9f5557b3cb16 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Mon, 15 Jan 2024 09:50:59 +0100 Subject: aw --- serialize/packbits-write.hpp | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) (limited to 'serialize/packbits-write.hpp') diff --git a/serialize/packbits-write.hpp b/serialize/packbits-write.hpp index faa3ff00..4217d739 100644 --- a/serialize/packbits-write.hpp +++ b/serialize/packbits-write.hpp @@ -24,6 +24,15 @@ struct output T value{0}; + template + struct next_ + { + static_assert(N > 0); + static_assert(N <= CAPACITY); + using type = output; + }; + template using next = typename next_::type; + template constexpr T set(T x, output_bits) const { @@ -37,27 +46,19 @@ struct output value_ |= x_; return value_; } - - template - struct next_ - { - static_assert(N > 0); - static_assert(N <= CAPACITY); - using type = output; - }; - - template using next = typename next_::type; }; -template -using output_field = std::pair>; - -template struct empty_pack_tuple {}; // todo copypasta +template +struct output_field +{ + T value; + static constexpr size_t Length = LENGTH; +}; template constexpr T write_(output st, output_field field, Fields... fields) { - T value = st.set(field.first, field.second); + T value = st.set(field.value, output_bits{}); using next = typename output::template next; return write_(next{value}, fields...); } -- cgit v1.2.3