fork download
  1. #include <iostream>
  2. #include <vector>
  3.  
  4. const std::vector<int> getvec(){
  5. return {1, 2, 3};
  6. }
  7.  
  8.  
  9. int main() {
  10. std::vector<int> foo{ 11, 12 };
  11. [&](const auto &bar){ foo.insert(foo.end(), bar.begin(), bar.end()); }(getvec());
  12. for(int num : foo) {
  13. std::cout << num << std::endl;
  14. }
  15. return 0;
  16. }
Success #stdin #stdout 0s 4376KB
stdin
Standard input is empty
stdout
11
12
1
2
3