chore: check for availability of boyer_moore_horspool_searcher

This commit is contained in:
Marcus Holland-Moritz 2024-01-23 15:06:34 +01:00
parent 7b3e718cda
commit 63dff242d4

View File

@ -28,6 +28,7 @@
#include <sstream> #include <sstream>
#include <unordered_map> #include <unordered_map>
#include <vector> #include <vector>
#include <version>
#include <fmt/format.h> #include <fmt/format.h>
@ -94,9 +95,12 @@ class filesystem_parser {
} }
auto ss = mm.span<char>(start); auto ss = mm.span<char>(start);
auto it = std::search( #if __cpp_lib_boyer_moore_searcher >= 201603
ss.begin(), ss.end(), auto searcher = std::boyer_moore_searcher(magic.begin(), magic.end());
std::boyer_moore_horspool_searcher(magic.begin(), magic.end())); #else
auto searcher = std::default_searcher(magic.begin(), magic.end());
#endif
auto it = std::search(ss.begin(), ss.end(), searcher);
if (it == ss.end()) { if (it == ss.end()) {
break; break;