Guest User

Untitled

a guest
May 17th, 2025
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. struct A {
  2. int _M_i;
  3. void ref() {__atomic_fetch_add(&_M_i, 1, 0); }
  4. };
  5.  
  6. struct B {
  7. B();
  8. void insertOne(B);
  9. void emplace() {
  10. B dummy;
  11. insertOne(dummy);
  12. }
  13. B(B &other) : d(other.d), ptr(other.ptr) {
  14. d->ref();
  15. }
  16. A *d;
  17. int *ptr;
  18. };
  19.  
  20. void testing() {
  21. B test;
  22. test.emplace();
  23. }
  24.  
Advertisement
Add Comment
Please, Sign In to add comment