fork download
  1. #include <iostream>
  2.  
  3. struct foo {
  4. void bar() { std::cout << "bar" << std::endl; }
  5. };
  6.  
  7. int main() {
  8. foo o1, o2;
  9. for( auto i : { &o1, &o2 } ) i->bar();
  10. return 0;
  11. }
Success #stdin #stdout 0s 4436KB
stdin
Standard input is empty
stdout
bar
bar