fork download
  1. #include <vector>
  2. #include <iostream>
  3. #include <algorithm>
  4. #include <functional>
  5. using namespace std;
  6. struct Add : public binary_function<int, int, int> {
  7. int operator()(const int & _Left, const int & _Right) const//LINE I
  8. { return _Left+_Right;}
  9. };
  10. void printer(int i) {
  11. cout << i << ", ";
  12. }
  13. int main() {
  14. int mynumbers[] = { 3, 9, 0, 2, 1, 4, 5 };
  15. vector<int> v1(mynumbers, mynumbers + 7);
  16. vector<int> v2(7);
  17. transform(v1.begin(), v1.end(), v2.begin(), bind1st(Add, -1));//LINE II
  18. for_each(v2.rbegin(), v2.rend(), printer);
  19. return 0;
  20. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function 'int main()':
prog.cpp:17:64: error: expected primary-expression before ',' token
         transform(v1.begin(), v1.end(), v2.begin(), bind1st(Add, -1));//LINE II
                                                                ^
stdout
Standard output is empty