fork(2) download
  1. #include <iostream>
  2.  
  3. class myclass{
  4. public:
  5. myclass(const myclass &other){std::cout << "copy\n";}
  6. myclass(myclass &&other){std::cout << "move\n";}
  7.  
  8. template<typename Special>
  9. myclass(Special &&arg){std::cout << "special\n";}
  10. };
  11.  
  12. int main() {
  13. const myclass c1(42); // special: int
  14. myclass c2(c1); // copy
  15. myclass c3(c2); // special: myclass& (non const)
  16. myclass c4(std::move(c3)); // move
  17.  
  18.  
  19. }
Success #stdin #stdout 0s 3460KB
stdin
Standard input is empty
stdout
special
copy
special
move