Getting the pointer to 1-before an array is undefined behavior, i.e. begin() - 1 is not allowed.
So modify rfind to loop until the front and do a final comparison with begin()/first afterwards before returning npos.
Use a better-suited for-loop and modify find to look as similar as possible so the difference is easy to spot.
Getting the pointer to 1-before an array is undefined behavior, i.e.
begin() - 1
is not allowed. So modifyrfind
to loop until the front and do a final comparison withbegin()/first
afterwards before returningnpos
. Use a better-suited for-loop and modifyfind
to look as similar as possible so the difference is easy to spot.Fixes #357