#include <iostream>
#include <utility>
using namespace std;
struct LogMe {
std::string member;
LogMe() {
cout << __FUNCTION__ << " - def.ctor!" << endl;
}
~LogMe() {
cout << __FUNCTION__ << " - dtor!" << endl;
}
LogMe(LogMe const&) {
cout << __FUNCTION__ << " - cpy.ctor!" << endl;
}
LogMe& operator=(LogMe const&) {
cout << __FUNCTION__ << " - cpy.assign.op!" << endl;
return *this;
}
LogMe(LogMe&&) {
cout << __FUNCTION__ << " - move.ctor!" << endl;
}
LogMe& operator=(LogMe&&) {
cout << __FUNCTION__ << " - move.assign.op!" << endl;
return *this;
}
};
int main() {
cout << "# Construct Object via auto obj = ...\n";
auto obj = LogMe();
cout << "# Construct pair<int, object> via auto objp = ...\n";
auto objp = pair<int, LogMe>();
cout << "# Construct pair<int, object> via pair objp2; ...\n";
pair<int, LogMe> p2;
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8dXRpbGl0eT4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCnN0cnVjdCBMb2dNZSB7CglzdGQ6OnN0cmluZyBtZW1iZXI7CgoJTG9nTWUoKSB7CgkJY291dCA8PCBfX0ZVTkNUSU9OX18gPDwgIiAtIGRlZi5jdG9yISIgPDwgZW5kbDsKCX0KCX5Mb2dNZSgpIHsKCQljb3V0IDw8IF9fRlVOQ1RJT05fXyA8PCAiIC0gZHRvciEiIDw8IGVuZGw7Cgl9CglMb2dNZShMb2dNZSBjb25zdCYpIHsKCQljb3V0IDw8IF9fRlVOQ1RJT05fXyA8PCAiIC0gY3B5LmN0b3IhIiA8PCBlbmRsOwoJfQoJTG9nTWUmIG9wZXJhdG9yPShMb2dNZSBjb25zdCYpIHsKCQljb3V0IDw8IF9fRlVOQ1RJT05fXyA8PCAiIC0gY3B5LmFzc2lnbi5vcCEiIDw8IGVuZGw7CgkJcmV0dXJuICp0aGlzOwoJfQoJTG9nTWUoTG9nTWUmJikgewoJCWNvdXQgPDwgX19GVU5DVElPTl9fIDw8ICIg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