You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First of all, thanks for this great library!
This is not a bug but rather my own user error that I am hoping you can clarify.
I'm trying to call find_first_of passing a utf8_string as the first parameter.
This generates the following error:
error: no matching function for call to ‘utf8_string::find_first_of(utf8_string&, int&)’
int found_pos = haystack.find_first_of(needle, at_pos);
^
In file included from Phonemizer.cpp:8:0:
tinyutf8.h:1728:12: note: candidate: utf8_string::size_type utf8_string::find_first_of(const value_type*, utf8_string::size_type) const
size_type find_first_of( const value_type* str , size_type start_codepoint = 0 ) const ;
^~~~~~~~~~~~~
tinyutf8.h:1728:12: note: no known conversion for argument 1 from ‘utf8_string’ to ‘const value_type* {aka const char32_t*}’
Can you tell me the correct usage and/or how I can get a char32_t* from my utf8_string?
Thanks!
Shawn
The text was updated successfully, but these errors were encountered:
Sorry for the late reply. Find_first_of currently expects a literal of type char32_t (as you already figured out). You may get a literal through e.g. "0123456789"U. If you just happen to have a dynamic set of codepoints that you want to use find_first_of with (it seems you do), you can get a char32_t* with utf8_string::to_wide_literal().
Does that help you?
Cheers
Jakob
PS: I might add the overload that you are looking for to the library once I have the time to. What keeps me from doing that at the moment, is that all the find_* functions would need to receive that overload and I don't have an idea yet on how to quickly search for any of the codepoints in an utf8_string without much (heap-)memory overhead. So yeah, I may figure that out...
First of all, thanks for this great library!
This is not a bug but rather my own user error that I am hoping you can clarify.
I'm trying to call find_first_of passing a utf8_string as the first parameter.
This generates the following error:
error: no matching function for call to ‘utf8_string::find_first_of(utf8_string&, int&)’
int found_pos = haystack.find_first_of(needle, at_pos);
^
In file included from Phonemizer.cpp:8:0:
tinyutf8.h:1728:12: note: candidate: utf8_string::size_type utf8_string::find_first_of(const value_type*, utf8_string::size_type) const
size_type find_first_of( const value_type* str , size_type start_codepoint = 0 ) const ;
^~~~~~~~~~~~~
tinyutf8.h:1728:12: note: no known conversion for argument 1 from ‘utf8_string’ to ‘const value_type* {aka const char32_t*}’
Can you tell me the correct usage and/or how I can get a char32_t* from my utf8_string?
Thanks!
Shawn
The text was updated successfully, but these errors were encountered: