fork download
  1. #include <array>
  2. #include <experimental/array>
  3. #include <stdio.h>
  4.  
  5. namespace lfv2 = std::experimental::fundamentals_v2;
  6.  
  7. int main() {
  8. int a = 1,
  9. b = 2;
  10. for (int * i : lfv2::make_array(&a,&b)) { //< What's the cheapest way to make this temporary iterable construct?
  11. printf("%d\n", *i);
  12. *i += 100;
  13. }
  14. printf("%d, %d\n", a,b);
  15. return 0;
  16. }
Success #stdin #stdout 0s 15232KB
stdin
Standard input is empty
stdout
1
2
101, 102