Matthieu N.
Matthieu N.

Reputation:

What is a named object?

When talking about Return Value Optimisation (RVO), various texts mention exception cases related to the return of Named Objects. So in short:

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

Upvotes: 6

Views: 1958

Answers (1)

Hans Passant
Hans Passant

Reputation: 941635

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.

Upvotes: 5

Related Questions