Adds runtime alignment assertions, see #3267

This commit is contained in:
Daniel J. Hofmann
2016-11-09 00:23:38 +01:00
committed by Patrick Niklaus
parent 7dea7476f1
commit 559c88b36d
3 changed files with 23 additions and 2 deletions
+3 -1
View File
@@ -373,7 +373,9 @@ class StaticRTree
{
m_leaves_region.open(leaf_file);
std::size_t num_leaves = m_leaves_region.size() / sizeof(LeafNode);
m_leaves.reset(reinterpret_cast<const LeafNode *>(m_leaves_region.data()), num_leaves);
auto data_ptr = m_leaves_region.data();
BOOST_ASSERT(reinterpret_cast<uintptr_t>(data_ptr) % alignof(LeafNode) == 0);
m_leaves.reset(reinterpret_cast<const LeafNode *>(data_ptr), num_leaves);
}
catch (const std::exception &exc)
{