Class with delegating constructors
class A {
A(SomeObject obj,
int x,
const string& y
) {
A(SomeObject obj, const string& y)
:A(obj, 0, y) {}
};
Intended use:
SomeObject obj;
A a1(obj, "first");
A a2(obj, "second");
The construction is to build SomeObjectexactly once when the construction is performed A. Will it pass objto create a copy SomeObjectwhen delegating to another constructor? If so, how can I avoid this?
source
share