After many failed attempts at addressing my dissatisfaction with the
if (n) checks, I finally realized that the problem is the
while (first != last && end != end())
loop, which, when exited, gives no indication as to _why_ it was
exited. Any attempt to re-construct the exit condition must needs
re-check something that should be known already.
To fix, then, use a while (true) loop and react on first == last and
dst == end() separately.
As a drive-by, cache end().
Task-number: QTBUG-106200
Change-Id: Ic873774451df4102163e6e65d93c35e5dcbbb037
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>