Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <cstdio>
- static size_t number_of_copy_construction = 0;
- static size_t number_of_copy_assignment = 0;
- struct A {
- A() = default;
- A(const A&) {
- number_of_copy_construction += 1;
- }
- A& operator=(const A&) {
- number_of_copy_assignment += 1;
- }
- };
- int main(void) {
- A a = A();
- printf("%lu %lu\n", number_of_copy_construction, number_of_copy_assignment);
- }
Add Comment
Please, Sign In to add comment