От: | sergii.p | ||
Дата: | 06.12.18 15:03 | ||
Оценка: | 28 (5) |
#include <iostream>
using namespace std;
struct A
{
A() {s = "initial"; cout << "ctor" << endl;}
A(const A&a) {s = a.s; cout << "copy" << endl;}
A(A&&a) { s = std::move(a.s); cout << "move" << endl;}
A& operator=(const A&a) { s = a.s; cout << "copy=" << endl;}
A& operator=(A&&a) {s = std::move(a.s); cout << "move=" << endl;}
string s;
};
int main() {
A a;
try {
throw a;
}
catch(const A& ta){
cout << ta.s << endl;
}
cout << a.s;
return 0;
}
а вот какой... | |
' ctor move initial ' | |