diff options
author | Daniel Pauls <daniel1708.de+git@gmail.com> | 2022-04-05 22:13:45 +0200 |
---|---|---|
committer | Daniel Pauls <daniel1708.de+git@gmail.com> | 2022-04-05 22:33:03 +0200 |
commit | 513652d5947c1923a004318ea453cab786cabda1 (patch) | |
tree | 0165ba16626b33a9ce8c39378070420bf4f25a5d | |
parent | 27b952a8a16b75f47d62fd6d3b0cedc8a081655c (diff) |
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`.
-rw-r--r-- | src/libutil/util.cc | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/libutil/util.cc b/src/libutil/util.cc index 59e3aad6d..8ab385837 100644 --- a/src/libutil/util.cc +++ b/src/libutil/util.cc @@ -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); } |