fork(1) download
  1. #include <iostream>
  2. #include <vector>
  3.  
  4. struct S {
  5. S(const char* v_) : m_v(v_) {}
  6. ~S() {
  7. std::cout << "destructing ~S(" << m_v << ")\n";
  8. }
  9. const char* m_v;
  10. };
  11.  
  12. int main()
  13. {
  14. std::vector<S> v;
  15. v.emplace_back("hello");
  16. v.clear();
  17.  
  18. v.emplace_back("fin");
  19. }
  20.  
Success #stdin #stdout 0s 3276KB
stdin
Standard input is empty
stdout
destructing ~S(hello)
destructing ~S(fin)