fork download
  1. #include<iostream>
  2. #include<algorithm>
  3.  
  4. struct MyStruct
  5. {
  6. int a;
  7. int b;
  8. };
  9.  
  10. void foo()
  11. {
  12. MyStruct abc;
  13. abc.a = 123;
  14. abc.b = 321;
  15.  
  16. MyStruct arr[100];
  17. // fill 100 MyStruct's with copy of abc
  18. std::fill_n(arr, 100, abc); // compilation error
  19.  
  20.  
  21. }
  22.  
  23. int main()
  24. {
  25. foo();
  26.  
  27. }
Success #stdin #stdout 0s 3292KB
stdin
Standard input is empty
stdout
Standard output is empty