Re: [eigen] MatrixBase::swap -- why const?

[ Thread Index | Date Index | More Archives ]

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:


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....


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.

Mail converted by MHonArc 2.6.19+