Guest User

Untitled

a guest
Feb 20th, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. #include <cstdio>
  2. static size_t number_of_copy_construction = 0;
  3. static size_t number_of_copy_assignment = 0;
  4. struct A {
  5. A() = default;
  6. A(const A&) {
  7. number_of_copy_construction += 1;
  8. }
  9. A& operator=(const A&) {
  10. number_of_copy_assignment += 1;
  11. }
  12. };
  13.  
  14. int main(void) {
  15. A a = A();
  16. printf("%lu %lu\n", number_of_copy_construction, number_of_copy_assignment);
  17. }
Add Comment
Please, Sign In to add comment