Last active
December 2, 2021 01:23
-
-
Save LucianoPAlmeida/8d8962846490f9afdf3ab14c36b855f3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <string> | |
#include <utility> | |
#include <iostream> | |
class A { | |
int member{}; | |
public: | |
~A() {}; // User defined destructor; | |
}; | |
class B { | |
int member{}; | |
public: | |
B(const B &obj) {} // User defined copy constructor | |
}; | |
class C { | |
int member{}; | |
}; | |
int main() { | |
std::cout << "A: " << std::is_trivially_move_constructible<A>::value << std::endl; | |
// A: 0 since A has an user-defined destructor. | |
std::cout << "B: " << std::is_trivially_move_constructible<B>::value << std::endl; | |
// B: 0 since B has an user-defined copy-constructor. | |
std::cout << "C: " << std::is_trivially_move_constructible<C>::value << std::endl; | |
// C: 1 all the rules for generating an implicit move are satisfied. | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment