fork download
  1. #include <iostream>
  2. #include <string>
  3. #include <vector>
  4.  
  5. using namespace std;
  6.  
  7. struct S {
  8. double d0 = 0.0;
  9. double d1 = 0.0;
  10. };
  11.  
  12. void f(const std::vector<S>& vp) {
  13. std::vector<S> fv = vp;
  14. fv[0].d0 = 3.0;
  15. cout << fv[0].d0;
  16. }
  17.  
  18. int main() {
  19. std::vector<S> v0 = {{2.0, 2.0}};
  20. f(v0);
  21. cout << v0[0].d0;
  22. return 0;
  23. }
  24.  
Success #stdin #stdout 0s 15232KB
stdin
Standard input is empty
stdout
32