fork(1) download
  1. #include <vector>
  2. #include <cstdio>
  3. using std::vector;
  4.  
  5. class branch
  6. {
  7. public:
  8. int th;
  9.  
  10. private:
  11. branch( const branch& other );
  12. const branch& operator=( const branch& other );
  13.  
  14. public:
  15.  
  16. branch() : th(0) {}
  17.  
  18. branch( branch&& other )
  19. {
  20. printf( "called! other.th=%d\n", other.th );
  21. }
  22.  
  23. const branch& operator=( branch&& other )
  24. {
  25. printf( "called! other.th=%d\n", other.th );
  26. return (*this);
  27. }
  28.  
  29. };
  30.  
  31.  
  32.  
  33. int main()
  34. {
  35. vector<branch> v;
  36. branch a;
  37. v.push_back( std::move(a) );
  38.  
  39. return 0;
  40. }
Success #stdin #stdout 0s 3428KB
stdin
Standard input is empty
stdout
called! other.th=0