Re: [eigen] Issues regarding Quaternion-alignment and const Maps |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] Issues regarding Quaternion-alignment and const Maps
- From: Gael Guennebaud <gael.guennebaud@xxxxxxxxx>
- Date: Wed, 7 Jul 2010 11:28:54 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:received:in-reply-to :references:from:date:message-id:subject:to:content-type; bh=oN2K1JaydMfOl6cbC5fAhFiv7k5gt7tKVAkXtOffNsA=; b=iXO6tBOARL3Yp1IBtO94ogItpUgWnNTDz5zlQcw4kWgyOO61iUtUBghh2lLlaUkOyt i3A7i99Jl7ttDBW72kOuyYMNRKbR4EhhdD+T1+CTjYvEsJzMHABcUiB+0NXhH8gOLwDi PlrhBYNPXT7rqgWURsHlKVeS4xiHgnRv27gEg=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; b=GOETOxhE5Je4DTuyQCgkdLkVjH5Sy6M9IeWFpX2G69LF5LiECSXZU46WPehZnGceEg h4AwdAsIriGd+HgdzuaeeWzs3Qf13eoZVKxLU7vmx2vkhnsv8+V6wUVgeoVHb4O3OtSx e0gkrMFvvV8ug8MGgzmJGMcymhRqZjjYM12iw=
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