Re: [eigen] Eigen Types as Parameters for Functions

[ Thread Index | Date Index | More Archives ]

>> * Does A.row(3); change after calling foo1(A.row(3))? (i.e. is it
>>  copied back?) -- you could simply copy it back in the destructor, if
>>  match_helper<Derived>::type() is false_type.
>>  If you think back-copying causes too much performance penalty, you
>>  need to forbid this.
>>  Furthermore, it sometimes might be useful to mark Ref as a pure
>>  "out-ref" in this case, saving the copy from A.row() to m_object.
> That's a very good remark, and currently I don't have a strong opinion
> whether we should copy-back or forbid it. The copy-back option is ok
> when Ref is used for function arguments and in sequential algorithms,
> but very dangerous in all other cases. For instance, I was thinking
> about Ref<> inside Eigen itself to reduce template instantiations. In
> this case you clearly don't want the copy-back approach.
>  On the other hand, I known it would be very convenient for many
> users. Proposing both might be overkill.

What if Ref<Something> copies back while Ref<const Something> doesn't?


Mail converted by MHonArc 2.6.19+