fork download
  1. #include <algorithm>
  2. #include <iostream>
  3. #include <string>
  4. #include <vector>
  5.  
  6. int main()
  7. {
  8. std::vector<std::string> v = { "foo", "bar" };
  9.  
  10. std::sort(v.begin(), v.end());
  11.  
  12. std::for_each(v.begin(), v.end(), [](std::string const& elem) {
  13. std::cout << elem << "\n";
  14. });
  15.  
  16. return 0;
  17. }
Success #stdin #stdout 0s 3064KB
stdin
Standard input is empty
stdout
bar
foo