fork download
  1. #include <iostream>
  2. #include <vector>
  3. #include <algorithm>
  4. using namespace std;
  5.  
  6. struct pospos {
  7. bool operator()( int n ) { return n > 10; }
  8. };
  9.  
  10. int main() {
  11. vector<int> vv(20);
  12. vector<int> tt(20);
  13.  
  14. for( int i = 0; i < 20; ++i ) vv[i] = i;
  15.  
  16. cout << "First Print: " << endl;
  17. for( int i = 0; i < 20; ++i ) cout << "vv[" << i << "]: " << vv[i] << endl;
  18. for( int i = 0; i < 20; ++i ) cout << "tt[" << i << "]: " << tt[i] << endl;
  19.  
  20. copy_if( vv.begin(), vv.end(), tt.begin(), pospos() );
  21.  
  22. cout << "Second Print: " << endl;
  23. for( int i = 0; i < 20; ++i ) cout << "tt[" << i << "]: " << tt[i] << endl;
  24. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:20:54: error: ‘copy_if’ was not declared in this scope
stdout
Standard output is empty