fork download
  1. #include <iostream>
  2. #include <queue>
  3.  
  4. struct probe {
  5. probe() { std::cout << "probe()" << ((void*)this) << std::endl; }
  6. probe(const probe&) { std::cout << "probe(c&)" << ((void*)this) << std::endl; }
  7. probe(probe&&) { std::cout << "probe(&&)" << ((void*)this) << std::endl; }
  8. ~probe() { std::cout << "~probe()" << ((void*)this) << std::endl; }
  9. };
  10.  
  11. int main() {
  12. std::queue<probe> my_queue;
  13.  
  14. probe p;
  15. my_queue.push(std::move(p));
  16.  
  17. return 0;
  18. }
  19.  
Success #stdin #stdout 0s 5548KB
stdin
Standard input is empty
stdout
probe()0x7fff3717512f
probe(&&)0x55e7dbaeaec0
~probe()0x7fff3717512f
~probe()0x55e7dbaeaec0