From 695b888d6599fdb13d300e7edfbb33eef7e0e47b Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Thu, 18 Jan 2024 18:05:11 +0100 Subject: a --- serialize/packbits-read.hpp | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'serialize') diff --git a/serialize/packbits-read.hpp b/serialize/packbits-read.hpp index 1d7056c3..39146bea 100644 --- a/serialize/packbits-read.hpp +++ b/serialize/packbits-read.hpp @@ -1,11 +1,10 @@ #pragma once #include "packbits-impl.hpp" -#include "compat/reverse-index-sequence.hpp" +#include "compat/assert.hpp" #include #include #include -#include -#include "compat/assert.hpp" +#include namespace floormat::Pack_impl { @@ -84,18 +83,18 @@ template st, std::index_sequence) { using U = std::decay_t; - static_assert(Left <= sizeof(T)*8); - static_assert(Left > 0); - static_assert(std::tuple_size_v >= sizeof...(Is)+1); + static_assert(Left <= sizeof(T)*8, "too few bits to read into tuple"); + static_assert(Left > 0, "too few bytes in datatype"); + static_assert(std::tuple_size_v >= sizeof...(Is)+1, "index count larger than tuple element count"); static_assert(I < std::tuple_size_v, "too few tuple elements"); using Field = std::decay_t>; - static_assert(is_input_field::value); + static_assert(is_input_field::value, "tuple element must be input"); constexpr size_t Size = Field::Length; static_assert(Size <= Left, "data type too small"); using next_type = typename input::template next; std::get(tuple).value = st.template get(); T next_value = st.template advance(); - read_(tuple, next_type{ next_value }, std::index_sequence{}); + read_(Utility::forward(tuple), next_type{ next_value }, std::index_sequence{}); } template @@ -114,7 +113,7 @@ constexpr void pack_read(Tuple&& tuple, T value) { constexpr size_t nbits = sizeof(T)*8, tuple_size = std::tuple_size_v>; - Pack_impl::read_(std::forward(tuple), + Pack_impl::read_(Utility::forward(tuple), Pack_impl::input{value}, std::make_index_sequence{}); } -- cgit v1.2.3