Open
Description
Lots of generic STL code would always do:
for(auto &i : container)
This prevents the value copy of items being iterated. You have proxy pair in place to prevent this occurring for:
for(auto i : container)
Firstly, any compiler which is not MSVC will elide that copy under optimisation if i
never escapes or is modified. So your proxy optimisation probably doesn't actually save much, except on MSVC.
Meanwhile, the lack of value sematics for the second for loop causes much generic code to break. If the code asked for a copy, it expects an as-if copy. If you wish to retain your proxy, you ought to have it implicitly convert to a value type upon demand in order to retain expected semantics.
Activity