Re: [eigen] Eigen Types as Parameters for Functions |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] Eigen Types as Parameters for Functions
- From: Márton Danóczy <marton78@xxxxxxxxx>
- Date: Wed, 27 Jun 2012 15:12:46 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=YE8R45dOBWYu6KWs//1JXCrrNkzqkrmgzxkMyqz/ikw=; b=i9vOA/fCwx0GMCV2Tso2lNmiC6a+KuHpcej34C7WirPq/eLRUbemlHxqDmfAiqBQTx SgEoo5kBHXzBzLW7bSelfjfCg/wLAplAB+2salGMgEl1wBBrACIcBUMlha6OiTV3qZfn 0LlSF0+F3damCkmP33Qs7lipgcCFBZt8EY2+W9CG3ZGu+1LGQ3S6bbNTVcv34RIth37a DfUFJfyTJWDF0ZMyf4EJ64MXVRiJFlguu781ew4yyw1i651FAH6sqr9I9O6cjWPkgf9R bmu5+dF/C0BCmWAWT4QhcRFETfqs96wZFOLQPy/qFz0kxJt0ycIvMGhnWRFq7jSygCCc 4d9Q==
>> * 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?
Marton