r/cpp • u/thisnotes • 2d ago
NRVO from compilers' perspective
https://thisnotes.dev/blog/nrvo/Hey. I've recently presented at Meeting C++ 2026 with a talk about NRVO. While you wait for the recording being available, you can check text version of the talk on my blog.
Also I have newsletter about C++, performance and backends: https://thisnotes.substack.com/
26
Upvotes
3
u/UnusualPace679 1d ago
The example is bogus as it doesn't use the function
f. Even if it does, the effect depends on whetherSis non-trivial for the purposes of calls.Should be
S& s = __c.s;notS s = __c.s;. As the name suggests, structured bindings are name bindings for components of an object. That is, withinf(),sis just a name of__c.s, not a new object. (Though technically, bindings are not references either. If you applydecltype, you'll get the referenced type.)