fork download
  1. #include <iostream>
  2. #include <locale>
  3. #include <functional>
  4. #include <algorithm>
  5. #include <string>
  6.  
  7. std::string &stringToLower(std::string &str) {
  8. using namespace std::placeholders;
  9. auto tolower_f = std::bind(std::tolower<char>, _1, std::locale());
  10.  
  11. std::transform(str.begin(), str.end(), str.begin(), tolower_f);
  12. return str;
  13. }
  14.  
  15. int main() {
  16. std::string str("AlA Ma koTa");
  17.  
  18. std::cout << stringToLower(str);
  19.  
  20. return 0;
  21. }
Success #stdin #stdout 0s 3060KB
stdin
Standard input is empty
stdout
ala ma kota