Re: [eigen] Issues regarding Quaternion-alignment and const Maps

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


On Wed, Jul 7, 2010 at 10:53 AM, Hauke Heibel
<hauke.heibel@xxxxxxxxxxxxxx> wrote:
> Regarding Gael's comment about the increased types and build times, I
> think const correctness should be preferred over shorter build times.

yes, and if we do this for Block too, then we should be safe with
swapping blocks. Currently the following works:

const MatrixXf m;

m.col(i).swap(m.col(j));

because swap has to take its argument by const reference (C++ mess)
and then the first thing swap does is to const_cast its argument.

But now, if "DenseBase::col(Index) const" returns a "const Block<const
Derived>" instead of a "const Block<Derived>", then in the above
example, the const_cast which happens in swap will return a
Block<const Derived> which is still const => compilation error and we
are safe :)

gael



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