pool: avoid alignment warnings on ARM

This commit is contained in:
Danny Robson 2017-01-05 19:50:00 +11:00
parent 98dc992473
commit ee53f8234b
2 changed files with 25 additions and 25 deletions

View File

@ -29,7 +29,7 @@ namespace util {
template <typename T> template <typename T>
class pool : public nocopy { class pool : public nocopy {
protected: protected:
union node { union alignas (T) node {
node *_node; node *_node;
char _data[sizeof (T)]; char _data[sizeof (T)];
}; };

View File

@ -98,7 +98,7 @@ namespace util {
// save what will become the next node shortly. it could be overwritten // save what will become the next node shortly. it could be overwritten
// in the constructor we're about to call. // in the constructor we're about to call.
node *newnext = m_next->_node; node *newnext = m_next->_node;
T *data = reinterpret_cast<T*> (m_next->_data); T *data = reinterpret_cast<T*> (m_next);
// try to construct the returnable object. // try to construct the returnable object.
try { try {