fork(1) download
  1. #include <string>
  2. #include <vector>
  3. #include <algorithm>
  4. #include <iterator>
  5. #include <list>
  6.  
  7. struct Student_info
  8. {
  9. int grade() { return 0; }
  10. };
  11.  
  12. class Grade_gen
  13. {
  14. public:
  15. std::vector<Student_info> students;
  16. bool has_passed(Student_info&);
  17. std::list<Student_info>::iterator process_students(std::list<Student_info>&);
  18. private:
  19.  
  20. };
  21.  
  22. using std::vector; using std::remove_if;
  23.  
  24. bool Grade_gen::has_passed(Student_info& student){
  25.  
  26. if (student.grade() > 60)
  27. {
  28. return true;
  29. }
  30. return false;
  31. }
  32.  
  33. bool test(Student_info& student)
  34. {
  35. return true;
  36. }
  37.  
  38. std::list<Student_info>::iterator Grade_gen::process_students(std::list<Student_info>& students)
  39. {
  40. remove_if(students.begin(), students.end(), [this](Student_info& si) { return this->has_passed(si); });
  41.  
  42. // this is just to test the scope of the functions in the class, they work.
  43. std::list<Student_info>::iterator b = students.begin();
  44. has_passed(*b);
  45. return b;
  46. }
  47.  
  48. int main()
  49. {
  50. return 0;
  51. }
  52.  
Success #stdin #stdout 0s 4424KB
stdin
Standard input is empty
stdout
Standard output is empty