fork download
  1. #include <iostream>
  2. #include <vector>
  3. #include <algorithm>
  4. #include <iterator>
  5.  
  6. using namespace std;
  7.  
  8. struct Pachimon{
  9. int speed;
  10. };
  11.  
  12. int main() {
  13. vector<Pachimon> v = {
  14. {4},{7},{9},{10},{3},
  15. };
  16.  
  17. vector<int> vi;
  18.  
  19. transform(v.begin(), v.end(), back_inserter(vi),
  20. [](Pachimon pachi){return pachi.speed;} );
  21.  
  22. for(auto spd: vi){
  23. cout << spd << endl;
  24. }
  25.  
  26. return 0;
  27. }
Success #stdin #stdout 0s 4376KB
stdin
Standard input is empty
stdout
4
7
9
10
3