[eigen] STL compatible aligned_allocator + StdVector

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]


Hi again,

It seems that the aligned_allocator is missing two important operators - see also here for further details http://blogs.msdn.com/vcblog/archive/2008/08/28/the-mallocator.aspx.

bool operator!=(const aligned_allocator<T>& other) const
{
  return !(*this == other);
}

// Returns true if and only if storage allocated from *this
// can be deallocated from other, and vice versa.
// Always returns true for stateless allocators.
bool operator==(const aligned_allocator<T>& other) const
{
  return true;
}

I think that at least the second one is required (by std::swap) in order to get the code from StdVector compiled under VS 2008 (vc9). Furthermore, the ei_workaround_msvc_std_vector might be extended by

template <typename OtherT>
inline ei_workaround_msvc_std_vector(const Eigen::MatrixBase<OtherT>& other) : T(other) {}

This should allow the initialization via expressions like (taken from BVH.cpp)

v.push_back(VectorType::Random());

This still does not solve all problems for non MatrixBase derived types (e.g. AlignedBox) - simply because the constructor interface will not be inherited by ei_workaround_msvc_std_vector. Maybe template class specializations can help out.

I won't be answering to any responses of this mail since I am on holidays! Wish you all a happy Easter weekend.

Regards,
Hauke


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/