Assuming my current rule when programming with range-based loops says
Use
for(auto const &e :...)orfor(auto &e:...)when possible overfor(auto a: ...).
I base this on my own experience and this question for example.
But after reading about the new terse for loops I wonder, should I not replace my & in my rule with &&? As written here this looks like the Meyers' Universal References.
So, I ask myself, should my new rule either be
Use
for(auto const &&e :...)orfor(auto &&e:...)when possible ...
or does that not always work and therefore should rather be the quite complicated one
Check if
for(auto const &&e :...)orfor(auto &&e:...)is possible, then considerfor(auto const &e :...)orfor(auto &e:...), and only when needed do not use references.