MCPcopy Create free account
hub / github.com/ashvardanian/StringZilla / operator()

Method operator()

scripts/bench_find.cpp:142–147  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

140 : needle_(needle), searcher_(needle.begin(), needle.end()) {}
141 inline size_type needle_length() const noexcept { return needle_.size(); }
142 inline size_type operator()(std::string_view haystack) const noexcept {
143 auto match = std::search(haystack.begin(), haystack.end(), searcher_);
144 do_not_optimize(match);
145 if (match == haystack.end()) return std::string_view::npos; // No match found
146 return (size_type)(match - haystack.begin());
147 }
148 constexpr size_type skip_length() const noexcept { return 1; }
149};
150

Callers

nothing calls this directly

Calls 4

searchFunction · 0.85
do_not_optimizeFunction · 0.85
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected