|Re: [eigen] is returning Eigen::Ref objects legit?|
[ Thread Index |
| More lists.tuxfamily.org/eigen Archives
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] is returning Eigen::Ref objects legit?
- From: Dick Lyon <dicklyon@xxxxxxxxxx>
- Date: Mon, 20 May 2013 09:56:11 -0700
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:mime-version:in-reply-to:references:from:date:message-id :subject:to:content-type; bh=z/j17a/yPN2gy8n0PphZ4zHGCmO07aSR4WQszfNDR2c=; b=M/JXA9JRXURVXIY10EFfxmrq7ZYRZfVven354DcsSlgSwkP9X29BGJDSL6ENr1NkG+ On6cKm/eyVa+KXkj8ZqLIYlLOfJ1FrllBANE+WXsUE8l8Lr/Mr/Qoc3uv186M/W/tM1l ZU4m+pB5IijxopodYBRpt019ycQqvx3D8KRkVbos6EBKMpWaUigBQx4eaKhrXT3D+T8W ITujm6tMp+QAWzhWZJaPch+PJ9rkUYSAUyVTMd56nssJEMeWCo5v/LZVwR9l2dm6biDe 0lPjJTxa4ucqfbSCasinH6VnLo89SXotmFYkvFpmRjxkecUzwiPghpt1WTzKJloCFCZG SLVw==
But your examples don't include a case like the problem asked about. I think it is usually OK to return a const reference to a private member variable. The problem seems to come up because that member variable m_ is an eigen type, which perhaps involves some temp magic that's not obvious.
At least, that's how I interpreted the question, and the answer is of interest to me...