fork(1) download
  1. #include <iostream>
  2. #include <map>
  3. #include <algorithm>
  4. using namespace std;
  5. typedef string AnsiString;
  6. typedef std::pair<int, AnsiString> IntStringPair;
  7. typedef std::pair<int, IntStringPair> EdProgPair;
  8. typedef std::map<int, IntStringPair> EdProgramMap;
  9.  
  10. struct EditAchievementRow
  11. {
  12. int id_edform_ ;
  13. };
  14.  
  15. class UnaryPredicate {
  16. public:
  17. UnaryPredicate(const EditAchievementRow& ear)
  18. : ear_(ear) {}
  19. bool operator()(const EdProgPair& epp)
  20. {
  21. return epp.second.first == ear_.id_edform_;
  22. }
  23. private:
  24. EditAchievementRow ear_;
  25. };
  26.  
  27. int main() {
  28. // your code goes here
  29. EdProgramMap edprogrammap_;
  30. EditAchievementRow ear_;
  31.  
  32. EdProgramMap::const_iterator citer;
  33.  
  34. citer = std::find_if(
  35. edprogrammap_.begin(),
  36. edprogrammap_.end(),
  37. UnaryPredicate(ear_)
  38. );
  39. int rrr;
  40. if (citer != edprogrammap_.end())
  41. rrr = (*citer).first;
  42.  
  43. return 0;
  44. }
Success #stdin #stdout 0s 3092KB
stdin
Standard input is empty
stdout
Standard output is empty