Re: [eigen] Map const correctness now fixed |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] Map const correctness now fixed
- From: Benoit Jacob <jacob.benoit.1@xxxxxxxxx>
- Date: Fri, 10 Dec 2010 15:43:26 -0500
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=EN5U2KQuwcnss6DS7uWWBY8/Q1mXk+ZnONDv7dQPHWY=; b=airwRvhOUKZZKyXyMapq+fFkFeEfiqWkl5vWdfAd4oyJcQwPmGxLJNF5vyt85PSyNc XnvbrH1ag2nWB/6o/4cdBWsNK+ylJt0UGXZiQ2ps89HmzMipmixnjT7VE7oRXyXpUCr8 geRI5b7hi9WNZBBAq12vQQfqYM73+ds6KFpfk=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=W8YvnEV3SNzMTsy0/C8j7IBEAumZAVqgIlCE9WC7ND4FikRxUzL55KsJEwgPV7gAm2 xZgSXMRUZ/7M4hMwIoC+gQgIMCVQ4yhETeWcbShDrss9vpA+aFkTg5g9H/6nt4ubglJs 6whMqHaB1Xoyh2W3bl3Rol/UhxTHs4WFqWkeI=
2010/12/10 Jim Bosch <talljimbo@xxxxxxxxx>:
> On 12/10/2010 10:58 AM, Benoit Jacob wrote:
>>
>> 2010/12/10 Jim Bosch<talljimbo@xxxxxxxxx>:
>>>
>>> On 12/10/2010 07:25 AM, Benoit Jacob wrote:
>>>>
>>>> This was bug 54,
>>>> http://eigen.tuxfamily.org/bz/show_bug.cgi?id=54
>>>>
>>>
>>> Excellent!
>>>
>>> This applies to Block, Transpose, and other things with DirectAccessBit
>>> set
>>> too, right?
>>
>> There only ever was a problem with Map, right? Then, if you pass a Map
>> as argument to other expressions, like Block<Map<...> >, then yes
>> everything propagates.
>>
>
> Here's an example:
>
> void modify_matrix(Eigen::MatrixXd const & m) {
> Eigen::Transpose<Eigen::MatrixXd> t = m.transpose();
> b(0, 0) = 1.0;
> }
Oh sorry, you're right, more work is needed for all lvalue
expressions, not just Map.
Reopening bug 54.
Fortunately, all the ground work is there. It's just going to be more
of the same fixes that applied to Map.
Benoit
>
> My hope was that the const overload of MatrixBase::transpose() (and block(),
> and part(), etc.) would return a "Transpose<const T>" rather than a
> "Transpose<T> const" in order to ensure the above doesn't compile, and allow
> one to inadvertently modify a matrix passed by const reference.
>
> Maybe one should never actually have a non-temporary Transpose or Block, but
> I've found doing that fairly useful in making code readable, and I've been
> hoping it is at worst neutral for performance purposes.
>
>
> Jim
>
>
>