This is the C++ test I do. I thought move constructor would be called, but it's not.
class MyTest
{
public:
MyTest() {}
~MyTest() {}
MyTest(const MyTest& lv) {} // be called actually
MyTest(MyTest&& rv) {} // not be called actually, but i thought would
void operator=(const MyTest& lv) {
MyTest(std::move(lr)); // i thought the move constructor would be called here
}
};
int main()
{
MyTest m1;
MyTest m2 = m1;
return 0;
}
Aucun commentaire:
Enregistrer un commentaire