Re: [eigen] question on alignment

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


On 10.10.2012 10:32, Sylvain Pointeau wrote:
do we have to propagate the EIGEN_MAKE_ALIGNED_OPERATOR_NEW to every
class using a class containing an EIGEN class?

Yes, if that class needs to be aligned (basically, if its size is a multiple of 16) and you want to be able to allocate your class using new. Another case where you don't need it is when you inherit from a class which already has EMAON.
O.t.o.h. it can never hurt to add redundant EMAONs.

additionally for this:

class AList
{
   ...
   std::vector<A,Eigen::aligned_allocator<A> > mylist
   ...

public:
   EIGEN_MAKE_ALIGNED_OPERATOR_NEW    <---- do I have to use it here?
}

No, AList does not contain actual Eigen objects. The std::vector only consists of some pointers (which have to point to aligned addresses, so the Eigen::aligned_allocator is indeed necessary).

Christoph



--
----------------------------------------------
Dipl.-Inf. Christoph Hertzberg
Cartesium 0.049
Universität Bremen
Enrique-Schmidt-Straße 5
28359 Bremen

Tel: +49 (421) 218-64252
----------------------------------------------



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