fork download
  1. #include <iostream>
  2. #include <algorithm>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8. std::string str = "/test param 12 1";
  9. str.erase(std::remove_if(str.begin(), str.end(), isspace), str.end());
  10. std::transform(str.begin(), str.end(), str.begin(), ::tolower);
  11. str[0] = '_';
  12. cout << str << endl;
  13. return 0;
  14. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function 'int main()':
prog.cpp:9:58: error: no matching function for call to 'remove_if(std::basic_string<char>::iterator, std::basic_string<char>::iterator, <unresolved overloaded function type>)'
  str.erase(std::remove_if(str.begin(), str.end(), isspace), str.end());
                                                          ^
prog.cpp:9:58: note: candidate is:
In file included from /usr/include/c++/4.9/algorithm:62:0,
                 from prog.cpp:2:
/usr/include/c++/4.9/bits/stl_algo.h:926:5: note: template<class _FIter, class _Predicate> _FIter std::remove_if(_FIter, _FIter, _Predicate)
     remove_if(_ForwardIterator __first, _ForwardIterator __last,
     ^
/usr/include/c++/4.9/bits/stl_algo.h:926:5: note:   template argument deduction/substitution failed:
prog.cpp:9:58: note:   couldn't deduce template parameter '_Predicate'
  str.erase(std::remove_if(str.begin(), str.end(), isspace), str.end());
                                                          ^
stdout
Standard output is empty