#include <vector>
#include <iostream>
using namespace std;
struct X {
int i;
X(int i_): i(i_) { cout << "X(): " << i << endl; }
X(const X&x): i(x.i) { cout << "X(const X&): " << x.i << endl; }
X(X&&x): i(x.i) { cout << "X(X&&x): " << x.i << endl; }
};
X ternary(bool cond) {
X a(1);
X b(2);
return cond ? a : b;
}
X ifelse(bool cond) {
X a(1);
X b(2);
if(cond) return a; else return b; // uses
}
int main() {
X v = ternary(true);
X w = ifelse(true);
return 0;
}
I2luY2x1ZGUgPHZlY3Rvcj4KI2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKc3RydWN0IFggewogICBpbnQgaTsKICAgWChpbnQgaV8pOiBpKGlfKSB7IGNvdXQgPDwgIlgoKTogICAgICAgIiA8PCBpIDw8IGVuZGw7IH0KICAgWChjb25zdCBYJngpOiBpKHguaSkgeyBjb3V0IDw8ICJYKGNvbnN0IFgmKTogIiA8PCB4LmkgPDwgZW5kbDsgfQogICBYKFgmJngpOiBpKHguaSkgeyBjb3V0IDw8ICJYKFgmJngpOiAgICIgPDwgeC5pIDw8IGVuZGw7IH0KfTsKWCB0ZXJuYXJ5KGJvb2wgY29uZCkgewogICAgWCBhKDEpOwogICAgWCBiKDIpOwoKICAgIHJldHVybiBjb25kID8gYSA6IGI7Cn0KWCBpZmVsc2UoYm9vbCBjb25kKSB7CiAgICBYIGEoMSk7CiAgICBYIGIoMik7CgogICAgaWYoY29uZCkgcmV0dXJuIGE7IGVsc2UgcmV0dXJuIGI7IC8vIHVzZXMKfQppbnQgbWFpbigpIHsKICAgIFggdiA9IHRlcm5hcnkodHJ1ZSk7CiAgICBYIHcgPSBpZmVsc2UodHJ1ZSk7CiAgICByZXR1cm4gMDsKfQo=