Bug: compilation error on `partition` with single char argument
Describe the bug
I met compilation error on following code in README.md
auto parts = haystack.partition(':'); // Matching a character
It seem to be caused by the lack of overload function definition following:
partition_type partition(char pattern) const noexcept { return partition_(char_set{pattern}, 1); }
Steps to reproduce
#include "stringzilla/stringzilla.hpp"
int main() {
auto haystack = ashvardanian::stringzilla::string_view{"a:b:c"};
auto [before, match, after] = haystack.partition(':');
}
OS: Fedora Linux 40
Expected behavior
Same as haystack.partition(ashvardanian::stringzilla::char_set(";"))
StringZilla version
3.9.6
Operating System
Fedora Linux 40
Hardware architecture
x86
Which interface are you using?
C++ bindings
Contact Details
No response
Are you open to being tagged as a contributor?
- [X] I am open to being mentioned in the project
.githistory as a contributor
Is there an existing issue for this?
- [X] I have searched the existing issues
Code of Conduct
- [X] I agree to follow this project's Code of Conduct
Thank you, @toge! If it’s missing, it’s worth adding, but should use the substring search under the hood, as opposed to character-set search.
@ashvardanian Thank you for your advice! I understand the solution you suggested.
Could you update examples in README.md? I think we should avoid a situation where someone tries to compile the sample code and it fails.
Merging a patch now, but there is more functionality in the C++ layer that I forgot to implement:
using sz::string::cap;
using sz::string::unchecked;
I'm not sure if those are needed though. What do you think, @toge?
@ashvardanian Thank you for your quick response!
It would be helpful to have it implemented. For the “fast string processing” feature of Stringzilla, I would be happy to have a wider range of string processing within Stringzilla.