r/cpp • u/rsashka • Mar 13 '26
Trusted-CPP - Safe Software Developing in C++ with backward compatibility
https://trusted-cpp.org/I invite explore the concept of safe software developing in C++ while backward compatibility with legacy code. Please send feedback and constructive criticism on this concept and its implementation. Suggestions for improvement and assistance in the developint are also welcome.
26
Upvotes
View all comments
Show parent comment
11
u/MysticTheMeeM Mar 13 '26
Immediately above the call to sort, the vector is assigned a new value, that invalidates the iterators.
OPs system then infers those are invalid and produces an error on the subsequent two lines (both the begin iterator and reference to first element no longer refer to valid data).