mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-22 22:16:16 +02:00
tokenizeString: Fix semantic mistake
`string_view::find_first_not_of(...)` and `string_view::find_first_of(...)` return `string_view::npos` on error not `string::npos`.
This commit is contained in:
parent
27b952a8a1
commit
513652d594
1 changed files with 2 additions and 2 deletions
|
@ -1259,9 +1259,9 @@ template<class C> C tokenizeString(std::string_view s, std::string_view separato
|
|||
{
|
||||
C result;
|
||||
auto pos = s.find_first_not_of(separators, 0);
|
||||
while (pos != std::string::npos) {
|
||||
while (pos != std::string_view::npos) {
|
||||
auto end = s.find_first_of(separators, pos + 1);
|
||||
if (end == std::string::npos) end = s.size();
|
||||
if (end == std::string_view::npos) end = s.size();
|
||||
result.insert(result.end(), std::string(s, pos, end - pos));
|
||||
pos = s.find_first_not_of(separators, end);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue