Re: [eigen] MatrixBase::swap -- why const? |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] MatrixBase::swap -- why const?
- From: Benoit Jacob <jacob.benoit.1@xxxxxxxxx>
- Date: Thu, 4 Jun 2009 17:28:48 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=5XFMuGLH0zWxcDCaNykvAf2SPl1QL62RwoRmPZ8CxAw=; b=P7Qfl0LcOzdvLZ1Dd+pVIDrtxuUxngwbST8bfuQQobXgBg/1Q+E+iS/UN77hRlHI02 wKTTRE2zXowJvqTSoWNivHTE9lF509bi6YVQwhERBnUxweQBbFjBpCMLh7IqN5BC9M98 VfaUKjb0/F+9F7gY527RJIYSK3jhBBhki39Qc=
- 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=h+izRA4iWaRVXfegY9BWY0sDnZX/rigdZ1xy7WGji9fwt5txeRzRsVOZNIwQUk5UGl WhSw+946zRpDPKD0XrDLqLEHNya4n5KDtQ97EgIi4JcwXtXbofwZ1YbHxsT9kD5IzxFF lKO/EGOhUVm0WVVjB4chmaIPWoOsMgHR8MIa4=
i don't have a good solution for this one.
the problem is that c++ doesn't seem to allow to pass a non-constant
reference to a temporary.
so when we do:
matrix.row(i).swap(matrix.row(j))
we are passing the temporary matrix.row(j) object to swap, c++ doesn't
seem to allow to pass it as a non-const reference
I'd love to hear if i was completely missing something....
Benoit
2009/6/4 Mark Borgerding <mark@xxxxxxxxxxxxxx>:
> I'm struggling to understand
> template<typename OtherDerived/*, int OtherMode*/>
> void swap(const MatrixBase<OtherDerived>& other)
>
> Why is "other" a const reference? It is modified by the call, no?
> This seems like a violation of interface contract.
>
>
>
>
>