Make the block size of vector<bool> consistent

This commit is contained in:
Patrick Niklaus
2018-03-23 12:02:20 +00:00
parent c0dd5d7c76
commit c322d93435
6 changed files with 49 additions and 39 deletions
+5 -2
View File
@@ -43,8 +43,11 @@ BOOST_AUTO_TEST_CASE(rw_short)
BOOST_AUTO_TEST_CASE(rw_bool)
{
std::size_t num_elements = 1000;
std::unique_ptr<char[]> data = std::make_unique<char[]>(num_elements / sizeof(std::uint32_t));
util::vector_view<bool> view(reinterpret_cast<std::uint32_t *>(data.get()), num_elements);
auto data = std::make_unique<typename vector_view<bool>::Word[]>(
(num_elements + sizeof(typename vector_view<bool>::Word) - 1) /
sizeof(typename vector_view<bool>::Word));
util::vector_view<bool> view(reinterpret_cast<typename vector_view<bool>::Word *>(data.get()),
num_elements);
std::vector<bool> reference;
std::mt19937 rng;