 <p>I'm not certain that introducing a <em>last</em> iterator on the second range for <code>is_permutation</code> would make the function any less unwieldy. I think it would make it more confusing.</p> <p>The thing with permutations is that the semantics are in the name itself. To check that one sequence is a permutation of another, you expect the sequence with no <em>last</em> iterator to be at least as long as the first sequence.</p> <p>If that's not the case, then you don't need to call <code>is_permutation</code> because it simply can't be a permutation. If it's longer, you <em>expect</em> that it's not going to iterate past the length of the first sequence - why would it? Well, it doesn't - and that's what you expected, so no faith is lost.</p> <p>C++ does expect programmers to take basic precautions, and makes us responsible for bounds-checking in many cases. Without giving that control to the programmer, the power of the language is diminished. If I'm calling <code>is_permutation</code> then I <em>know</em> that my second iterator is not going to overflow, because I <em>know</em> what a permutation is. I certainly don't want to waste cycles doing pointless bounds-checking.</p> <p>I think the old saying applies: <em>With great power comes great responsibility</em>. That's fair enough, isn't it?</p>