MCPcopy Create free account
hub / github.com/boostorg/parser / search

Function search

include/boost/parser/detail/text/algorithm.hpp:320–356  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

318 typename Iter2,
319 typename Sentinel2>
320 search_result<Iter1>
321 search(Iter1 first1, Sentinel1 last1, Iter2 first2, Sentinel2 last2)
322 {
323 if (first1 == last1 || first2 == last2)
324 return {first1, first1};
325
326 if (detail::next(first2) == last2) {
327 auto const it = parser::detail::text::find(first1, last1, *first2);
328 if (it == last1)
329 return {it, it};
330 return {it, detail::next(it)};
331 }
332
333 auto it = first1;
334 for (;;) {
335 first1 = parser::detail::text::find(first1, last1, *first2);
336
337 if (first1 == last1)
338 return {first1, first1};
339
340 auto it2 = detail::next(first2);
341 it = first1;
342 if (++it == last1)
343 return {it, it};
344
345 while (*it == *it2) {
346 if (++it2 == last2)
347 return {first1, ++it};
348 if (++it == last1)
349 return {it, it};
350 }
351
352 ++first1;
353 }
354
355 return {first1, first1};
356 }
357
358 /** Sentinel-friendly version of `std::find_first_of()`. */
359 template<

Callers 7

mainFunction · 0.85
mainFunction · 0.85
search.hppFile · 0.85
iteratorClass · 0.85
containsMethod · 0.85
iteratorClass · 0.85
iteratorClass · 0.85

Calls 2

nextFunction · 0.85
findFunction · 0.85

Tested by

no test coverage detected