I'm desperate to understand a situation that occured to me last week.
In my c++ work project, its not rare to see this pattern
auto iter = std::find_if(vec.begin(), vec.end(), pred);if (iter != vec.end())return;
Nothing weird until now.
But, for one of the use of this pattern, i got a strange behavior.
I was in debug mode with MSVC and the "Checked Iterators" activated.
I knew my predicate did not find any valid element, so i was expecting iter to be equal to vec.end(), but the comparison iter != vec.end() kept crashing.
After investigation, i found that it crashed in function _Compat , that checks the iterator to be the from the same container (?), so that _Myproxy->_Mycont must be equal for both iterators (iter and vec.end()).
In my case, it was not equal, but looking further i noticed that vec.end()->_Myproxy->_Mycont was actually equal to iter->_Myproxy->_Mycont->_Myproxy->_Mycont.
So it means that the iterator returned by std::find_if was wrapped in the level of proxy instead of 1.
I don't understand how ot can happen, and why it happens only for this particular case.
Any idea ?