Jonathan Wood
Jonathan Wood

Reputation: 67223

Finding std::boyer_moore_searcher

I'd like to try using the std::boyer_moore_searcher class. But I've run into two questions:

  1. Where is it? I'm using Visual Studio 2019 but it reports "namespace std has no member boyer_moore_searcher".
  2. One of the issues with the Boyer Moore algorithm is that the jump table must be very large for Unicode characters. Can anyone tell me how the boyer_moore_searcher class deals with this?

Upvotes: 1

Views: 1277

Answers (2)

Oblivion
Oblivion

Reputation: 7374

This is the answer to the first question:

Where is it? I'm using Visual Studio 2019 but it reports "namespace std has no member boyer_moore_searcher".

boyer_moore_searcher is introduced in c++17 so to compile you need to enable c++17 option: MSVC Compile option /std:c++17 or:

propertie->C/C++->All Options->C++ Language Standard

.

Upvotes: 1

Marshall Clow
Marshall Clow

Reputation: 16660

One of the issues with the Boyer Moore algorithm is that the jump table must be very large for Unicode characters

This is not really an answer, but too long for a comment.

The "skip table" for Boyer-Moore needs to have an entry for every "character" in the pattern that you're searching for.

For char, the simplest (and fastest) way to do that is to have a 256-element array (and that's how the B-M algorithm was described in the original papers). But that's not a requirement; just an implementation detail.

Upvotes: 2

Related Questions