fork(2) download
  1. #include <iostream>
  2. #include <utility>
  3. using namespace std;
  4.  
  5. class ABC
  6. {
  7. public:
  8. ABC(){cout << "ABC" << endl;}
  9. ~ABC() noexcept {cout << "~ABC" << endl;}
  10. ABC(ABC const&) {cout << "copy" << endl;}
  11. ABC(ABC&&) noexcept {cout << "move" << endl;}
  12. ABC& operator=(ABC const&){cout << "copy=" << endl;}
  13. ABC& operator=(ABC&&) noexcept {cout << "move=" << endl;}
  14. };
  15.  
  16. int main() {
  17. std::pair<std::string, ABC> myPair{{}, {}};
  18. //std::pair<std::string, ABC> myPair = std::make_pair<std::string, ABC>({}, {});
  19. return 0;
  20. }
Success #stdin #stdout 0s 3096KB
stdin
Standard input is empty
stdout
ABC
copy
~ABC
~ABC