diff --git a/include/ylt/struct_pack/reflection.hpp b/include/ylt/struct_pack/reflection.hpp index 35c2fc41d0..441193c6a4 100644 --- a/include/ylt/struct_pack/reflection.hpp +++ b/include/ylt/struct_pack/reflection.hpp @@ -402,19 +402,30 @@ template } && (Type{}.size()+7)/8 == sizeof(Type); #else template - struct bitset_container_impl : std::false_type {}; + struct bitset_impl : std::false_type {}; + template - struct bitset_container_impl().size()>, + struct bitset_impl().flip()), decltype(std::declval().set()), decltype(std::declval().reset()), - decltype(std::declval().count())>> + decltype(std::declval().count()), + decltype(std::declval().size())>> : std::true_type {}; + template + constexpr bool bitset_size_checker() { + if constexpr (bitset_impl::value) { + return (T{}.size()+7)/8==sizeof(T); + } + else { + return false; + } + } + template - constexpr bool bitset = bitset_container_impl::value && sizeof(T)==(T{}.size()+7)/8; + constexpr bool bitset = bitset_impl::value && bitset_size_checker(); #endif #if __cpp_concepts >= 201907L