diff --git a/include/boost/unordered/detail/foa.hpp b/include/boost/unordered/detail/foa.hpp index 906accb1..bca20d8a 100644 --- a/include/boost/unordered/detail/foa.hpp +++ b/include/boost/unordered/detail/foa.hpp @@ -15,13 +15,14 @@ #include #include #include +#include #include #include #include -#include -#include #include #include +#include +#include #include #include #include @@ -137,6 +138,9 @@ struct group15 return at(N-1)==sentinel_?match_occupied()&0x3FFF:match_occupied(); } + static constexpr struct{alignas(16) unsigned char storage[N+1];} dummy_group= + {{0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0}}; + private: static constexpr unsigned char available_=0, sentinel_=1; @@ -691,22 +695,14 @@ private: static group_type* dummy_groups()noexcept { -#if defined(BOOST_UNORDERED_SSE2) - static_assert( - std::is_same::value, - "encapsulation breach" - ); - alignas(group_type) static constexpr unsigned char - storage[sizeof(group_type)*2]={ - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 - }; + using dummy_group_layout= + typename std::remove_const::type; - return reinterpret_cast(const_cast(storage)); + static constexpr dummy_group_layout + storage[2]={group_type::dummy_group,group_type::dummy_group}; + + return reinterpret_cast(const_cast(storage)); } -#else -#error encapsulation breach -#endif void delete_arrays(const arrays_info& arrays_)noexcept {