fork download
  1. #include <iostream>
  2. #include <vector>
  3. #include <map>
  4. using namespace std;
  5.  
  6. class Observation
  7. {
  8. public:
  9. int getMonth() { return 0; }
  10. };
  11.  
  12. class Sample
  13. {
  14. map<int, vector<Observation*>*> *m_observations = NULL;
  15. public:
  16. Sample(vector<Observation*> * vec_observations)
  17. {
  18. this->m_observations = new map<int, vector<Observation*>*>;
  19.  
  20. vector<Observation*>::iterator it;
  21.  
  22. for(it = vec_observations->begin(); it != vec_observations->end(); it++){
  23. (*m_observations)[(*it)->getMonth()]->push_back((*it));//ERROR LINE
  24. }
  25.  
  26. }
  27. };
  28.  
  29. int main()
  30. {
  31. // your code goes here
  32. vector<Observation*> obsvec;
  33. Sample s(&obsvec);
  34. return 0;
  35. }
Success #stdin #stdout 0s 3468KB
stdin
Standard input is empty
stdout
Standard output is empty