opt_classresults

Controls the omission of the copy constructor call for class return types if all return statements in a function return the same local class object.

Syntax

#pragma opt_classresults on | off | reset

Targets
All platforms.
Remarks

Example of using #pragma opt_classresults:

#pragma opt_classresults on

struct X {
X();
X(const X&);
// ...
};

X f() {
X x; // directly constructed in function result buffer
// ...
return x; // no copy-ctor call
}

This pragma does not correspond to any panel setting. To check this setting, use __option (opt_classresults), described in Checking Settings. The default setting is on.