Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- template <typename T>
- struct _check_default_and_copy_constructable
- {
- _check_default_and_copy_constructable()
- {
- T value1;
- volatile T value2(value1);
- }
- };
- #define check_default_and_copy_constructable(clazz) {_check_default_and_copy_constructable<clazz> _check;}
- class default_constructable_and_copy_constructable
- {};
- class non_default_constructable
- {
- public:
- non_default_constructable(int a)
- {
- cout << a;
- }
- };
- class non_copy_constructable
- {
- public:
- non_copy_constructable()
- {}
- private:
- non_copy_constructable(const non_copy_constructable&);
- };
- int main()
- {
- check_default_and_copy_constructable(default_constructable_and_copy_constructable);
- check_default_and_copy_constructable(non_default_constructable);
- check_default_and_copy_constructable(non_copy_constructable);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement