Do algorithms validate ranges?
Show answer and explanation
Algorithms generally trust their iterator ranges and documented preconditions; they do not validate that two iterators form a valid range or that an ordering requirement holds. Violating those contracts can make the program undefined.
Algorithms generally trust their iterator ranges and documented preconditions; they do not validate that two iterators form a valid range or that an ordering requirement holds. Violating those contracts can make the program undefined.
Connect the conclusion directly to the type, lifetime, ownership, overload-resolution rule, or library contract present in the question. State implementation dependence or a violated precondition explicitly instead of merely guessing output.