18 Feb
2003
18 Feb
'03
11:02 a.m.
On Monday 17 February 2003 19:21, Ivan Vecerina wrote:
The second copy will be avoided by the compiler if you use construction of a new variable instead of assignment: matrix<double> r1 = foo(); // shall avoid 2nd copy or: matrix<double> const& r2 = foo(); // always optimized // but can trigger a VC7 bug
Here you're taking a const-reference to a temporary.
From the moment you're using r2 you have 'undefined behaviour' IMHO.
t