Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Search implementation suggestions #8

Open
mclow opened this issue Sep 24, 2011 · 1 comment
Open

Search implementation suggestions #8

mclow opened this issue Sep 24, 2011 · 1 comment

Comments

@mclow
Copy link
Owner

mclow commented Sep 24, 2011

Phil Endecott writes:

  • The three algorithms have very similar interfaces. The docs could perhaps define a "searcher" concept and explicitly declare these algorithms' classes to be models of that concept.
  • std::search is similar to the three algorithms' free function versions (congratulations on getting the arguments in the same order!). For completeness, how about adding a searcher class that uses std::search?
  • It would sometimes be useful to have a variant of the constructor that takes a const char* pattern.
  • The tables store ints. For patterns shorter than 256 characters I think that uint8_t would be sufficient, and would reduce the size of a table from 1024 or 2048 bytes to only 256 bytes. Similarly uint16_t or uint32_t could be used for larger patterns. It is not obvious how to implement this, though; perhaps an optional max_pattern_length template parameter, making it the user's responsibility to ensure the supplied pattern is not too long.
@mclow
Copy link
Owner Author

mclow commented Sep 24, 2011

  • const char * constructor

You can do that today with ( str, str + strlen (str), but I'll think about how to do it better.
Maybe just a specialization for char * (and wchar?)
The trick, I think, will be to avoid having a general pointer-based version that insists on null termination.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant