Re: [eigen] Fixed-size vectorizable members and std::make_shared

[ Thread Index | Date Index | More Archives ]

On 02.04.2013 17:46, Márton Danóczy wrote:
I just ran into a subtle bug, the solution of which doesn't seem to be
documented anywhere. If I have a class with a fixed-size, vectorizable
member, even having defined EIGEN_MAKE_ALIGNED_OPERATOR_NEW, creating a
shared pointer to it using

     std::shared_ptr<MyClass> x = std::make_shared<MyClass>(42);

Apparently, std::make_shared uses ::new and not MyClass::new, so EIGEN_MAKE_ALIGNED_OPERATOR_NEW does not help here. I'm afraid it is not possible to specialized std::make_shared from inside the class (or is it possible in C++11?).

Is there a way to put an assertion in some constructor, maybe in that of
DenseStorage, to check that (this % 16 ==0)? It took me quite some time to
hunt down this bug...

There is an assertion in every (aligned) matrix constructor checking exactly that.
If you are using gcc4.7 and 32bit linux, I guess it is this bug:


Dipl.-Inf., Dipl.-Math. 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+