[eigen] About alignement: two use cases |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
Hello,
I have some use
cases that I'm not sure if they respect the alignement contraints. I would
be glad to to have your opinion about that.
USE CASE
#1
===========================
Let say I have a
class looking like this:
class
A
{
public:
Eigen::Vector6d v;
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
};
So far, I think
this is the right way to do it. However, if another class derive
from it:
class B : public
A
{
....
}
Does the class B has
also to use the EIGEN_MAMKE_ALIGNED_OPERATOR_NEW macro?
USE CASE
#2
===========================
Let say I have a
static library compiled with the EIGEN_DONT_ALIGN flash, which contains
this class:
class
C
{
public:
Eigen::Vector6d v;
}
Then, if I use this
class from another program that is NOT compiled with EIGEN_DONT_ALIGN,
e.g.:
int
main(void)
{
C* my_C = new C();
Eigen::Vector6d my_v = my_C.v;
return 0;
}
In that case, the
"v" member of class C is implicitly not aligned. However, the progam doesn't
specify anything about alignement. Does this makes sense? Does the casting will
be done correctly as in:
Eigen::MAtrix<double, 6, 1, Eigen::DontAlign>
v_unaligned;
Eigen::MAtrix<double, 6, 1> v_aligned;
v_aligned =
v_unaligned;
Thank
you,
------------------------------------
Philippe
Hamelin, ing. jr, M. Ing
Chercheur / Researcher
T: 450-652-8499 x2198
F: 450-652-1316
Expertise robotique et
civil
Institut de recherche d'Hydro-Québec (IREQ)
1740, boul.
Lionel-Boulet
Varennes (QC) J3X 1S1, Canada