@@ -271,10 +271,19 @@ auto last_known_good_find_first_of(FwdItH h_first, FwdItH h_last, FwdItN n_first
271
271
272
272
template <class RanItH , class RanItN >
273
273
auto last_known_good_search (RanItH h_first, RanItH h_last, RanItN n_first, RanItN n_last) {
274
- const auto n_len = n_last - n_first;
274
+ const ptrdiff_t n_len = n_last - n_first;
275
275
276
276
for (; h_last - h_first >= n_len; ++h_first) {
277
- if (equal (h_first, h_first + n_len, n_first, n_last)) {
277
+ bool is_equal = true ;
278
+
279
+ for (ptrdiff_t i = 0 ; i != n_len; ++i) {
280
+ if (*(h_first + i) != *(n_first + i)) {
281
+ is_equal = false ;
282
+ break ;
283
+ }
284
+ }
285
+
286
+ if (is_equal) {
278
287
return h_first;
279
288
}
280
289
}
@@ -284,7 +293,7 @@ auto last_known_good_search(RanItH h_first, RanItH h_last, RanItN n_first, RanIt
284
293
285
294
template <class RanItH , class RanItN >
286
295
auto last_known_good_find_end (RanItH h_first, RanItH h_last, RanItN n_first, RanItN n_last) {
287
- const auto n_len = n_last - n_first;
296
+ const ptrdiff_t n_len = n_last - n_first;
288
297
289
298
if (n_len > h_last - h_first) {
290
299
return h_last;
@@ -293,7 +302,16 @@ auto last_known_good_find_end(RanItH h_first, RanItH h_last, RanItN n_first, Ran
293
302
auto h_mid = h_last - n_len;
294
303
295
304
for (;;) {
296
- if (equal (h_mid, h_mid + n_len, n_first, n_last)) {
305
+ bool is_equal = true ;
306
+
307
+ for (ptrdiff_t i = 0 ; i != n_len; ++i) {
308
+ if (*(h_mid + i) != *(n_first + i)) {
309
+ is_equal = false ;
310
+ break ;
311
+ }
312
+ }
313
+
314
+ if (is_equal) {
297
315
return h_mid;
298
316
}
299
317
0 commit comments