Registered Member
|
I am wondering if anyone has come across an elegant solution regarding using fixed-size vectorizable Eigen types (and types that contain such types) within a boost::any...
The issue is that boost::any uses a container class (holder<T>) to actually hold the value of the boost::any. This container class has a member 'held' which is of type T. Imagine that T is Eigen::Vector4f, and you can see that holder<T> needs to have its new overloaded to return a 16-byte aligned pointer. Unfortunately this container class (holder<T>) is not easily modified, as it is really an internal class defined within boost::any. So has anyone figured out a nifty way to get around this issue? eigen 3.0.1 boost 1.43 Thanks, Eric |
Moderator
|
note that you can locally give up vectorization by using, e.g.,
Eigen::Matrix<float,4,1,Eigen::DontAlign> instead of Vector4f. Such objects will still be compatible with Vector4f ones, so you can copy the held object into Vector4f before actually using it. |
Registered Member
|
ggael, Thanks for the response. Unfortunately in my exact circumstance, this would not be practical, as what I am actually putting in the boost::any is an object of a class that has an Eigen::Vector4f member. Therefore it would be quite difficult to attempt to change it to use a non-aligned version locally. That said, the 'Eigen::DontAlign' specifier is a tool that I didn't know that I had and I may be able to use it elsewhere. Thanks, Eric |
Moderator
|
I see,
perhaps a ugly solution would be to template specialize holder<> for your type. |
Registered Member
|
Yes, that would be a solution. Hopefully it won't come to that |
Registered users: Bing [Bot], Google [Bot], q.ignora, watchstar