fork download
  1. #include <iostream>
  2. #include <vector>
  3. #include <algorithm>
  4.  
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9. vector<string> src { "123", "456", "789" };
  10. vector<int> res;
  11. transform(src.begin(), src.end(), back_inserter(res), [](string s) { return stoi(s); });
  12. for (auto& r : res)
  13. cout << r << endl;
  14. return 0;
  15. }
Success #stdin #stdout 0s 3476KB
stdin
Standard input is empty
stdout
123
456
789