Re: [eigen] Alignment of a derived class |

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

*To*: eigen@xxxxxxxxxxxxxxxxxxx*Subject*: Re: [eigen] Alignment of a derived class*From*: Martin Sälzle <martin.saelzle@xxxxxxx>*Date*: Thu, 19 Jul 2012 22:17:40 -0400

Am 19.07.2012 um 01:38 schrieb Gael Guennebaud: > On Thu, Jul 19, 2012 at 6:48 AM, Christoph Hertzberg > <chtz@xxxxxxxxxxxxxxxxxxxxxxxx> wrote: >> On 18.07.2012 23:29, Gael Guennebaud wrote: >>> >>> On Wed, Jul 18, 2012 at 4:18 AM, Martin Sälzle <martin.saelzle@xxxxxxx> >>> wrote: >>>> >>>> struct Base >>>> { >>>> Eigen::Vector4f vec4f_base; >>>> EIGEN_MAKE_ALIGNED_OPERATOR_NEW >>>> }; >>>> >>>> struct Derived1 : public Base >>>> { >>>> Eigen::Vector4f vec4f_derived_1; >>>> EIGEN_MAKE_ALIGNED_OPERATOR_NEW >>>> }; >>>> [...] >>>> >>>> The final question is what would happen for Derived1 if Base does note >>>> have EIGEN_MAKE_ALIGNED_OPERATOR_NEW? >>> >>> >>> On a 64bits system nothing special. On a 32bits system with SSE >>> enabled, an abort or segfault if you create a Derived1 on the heap >>> using "new Derived1". >> >> >> Actually, if Derived1 still has an EIGEN_MAKE_ALIGNED_OPERATOR_NEW, it >> should be ok to use `new Derived1`, shouldn't it? > > Sure! > > gael > >> Of course it is better to just add EIGEN_MAKE_ALIGNED_OPERATOR_NEW to the >> base class -- and it won't harm if you add it to the derived classes as >> well. >> >> Christoph >> >> >> >> >> >> -- >> ---------------------------------------------- >> Dipl.-Inf. Christoph Hertzberg >> Cartesium 0.049 >> Universität Bremen >> Enrique-Schmidt-Straße 5 >> 28359 Bremen >> >> Tel: +49 (421) 218-64252 >> ---------------------------------------------- >> >> > > Hi Gael, I have another question: I saw that you define typedef void eigen_aligned_operator_new_marker_type; in the macro EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF in Memory.h Do you have a structure in Eigen that checks if the typedef is defined, similar to the second example here: http://en.wikipedia.org/wiki/SFINAE If Eigen provides this I would not have to define it myself. Basically what I want to do is to use boost::conditional to check if I have to use the aligned allocator for a vector. thank you, Martin

**Follow-Ups**:**Re: [eigen] Alignment of a derived class***From:*Gael Guennebaud

**References**:**[eigen] Alignment of a derived class***From:*Martin Sälzle

**Re: [eigen] Alignment of a derived class***From:*Gael Guennebaud

**Re: [eigen] Alignment of a derived class***From:*Christoph Hertzberg

**Re: [eigen] Alignment of a derived class***From:*Gael Guennebaud

**Messages sorted by:**[ date | thread ]- Prev by Date:
**[eigen] Map/Block equivalence and vectorization** - Next by Date:
**Re: [eigen] Polynomial solver, eigenvalues of companion matrix and balancing** - Previous by thread:
**Re: [eigen] Alignment of a derived class** - Next by thread:
**Re: [eigen] Alignment of a derived class**

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