
7 Mar
2011
7 Mar
'11
6:34 a.m.
On 07/03/11 03:25, Peter Dimov wrote:
I probably should note that expression templates require CoW, as far as I can see; if you return an expression from a*b instead of computing the product, the expression needs to keep a and b alive. Having it store copies would defeat the purpose. Storing references wouldn't work well in generic code such as a forwarding function. Even something as simple as auto x = f() + y; would be a subtle bug. Well , ET based code usually keep references to large terminals. the 'auto'/ET interaction is known and is likely to never occurs. And if needed, well, that's what proto::deep_copy is for.