fork download
  1. #include <iostream>
  2. #include <list>
  3. #include <vector>
  4. #include <algorithm>
  5. using namespace std;
  6. class A{
  7. private:
  8. int _a;
  9. public:
  10. A(int a):_a(a){}
  11. ~A(){}
  12. };
  13.  
  14. typedef struct _SPID_FQA_
  15. {
  16. const char * filePath;
  17. std::vector<A> people;
  18. } STRUCT_SPID_QA;
  19.  
  20. int main ()
  21. {
  22. STRUCT_SPID_QA *st = new STRUCT_SPID_QA;
  23. st->people.push_back(A(5));
  24. cout << "brefore st's Size: "<< st->people.size() << endl;
  25. if(!st->people.empty())
  26. {
  27. cout << "cleared" << endl;
  28. st->people.clear();
  29. }
  30. cout << "after st's Size: "<< st->people.size() << endl;
  31. return 0;
  32. }
Success #stdin #stdout 0s 3428KB
stdin
Standard input is empty
stdout
brefore st's Size: 1
cleared
after st's Size: 0