When talking about Return Value Optimisation (RVO), various texts mention exception cases related to the return of Named Objects. So开发者_JAVA技巧 in short:
- What are they?
- Is there a definition for this term in the current c++ standard?
Side note: I've tried to add the following tags: RVO and NRVO but due to lack of reputation points I wasn't able to take this post correctly
A named object is just like it sounds:
someclass foo() {
someclass foo;
foo.member = 42;
return foo;
}
As opposed to:
someclass foo() {
return someclass(42);
}
The latter case is simple to optimize.
精彩评论