C++11 range based auto for loop by value, reference, and pointer

auto, c++, c++11, for-loop

Solution

A a[2];
for(auto& x_:a){
  auto* x = &x_;
  // code
}

Problem

I know how to use auto keyword in for loop to iterate this array either by value or reference. ``` struct A { void fun() {}; }; int main() { A a[2]; // Value for (auto x : a) { x.fun(); } // Ref for (auto& x : a) { x.fun(); } // Pointer //for (...) { x->fun(); } } ``` So I am looking third version of this convention. How do I use pointer here?

Original source