16 Nov
2017
16 Nov
'17
6:20 a.m.
On 16. Nov 2017, at 02:39, Gavin Lambert via Boost
wrote: On 16/11/2017 05:41, Peter Dimov wrote:
It's all slightly misleading anyway, because for the small matrix case the copy/move constructors don't actually have side effects and therefore get optimized out; they are only relevant in the case of something like std::string where copy/move aren't defaulted.
That was my point; your test code doesn't test copy elision because your constructors have side effects, so can't be elided.
Copy elision (RVO/NRVO) is part of the standard only because it allows the compiler to elide a copy-ctor even if it has side-effects. In other words, if the compiler would apply copy elision, you would see the side-effects to change.