diff options
Diffstat (limited to 'zencore/include')
| -rw-r--r-- | zencore/include/zencore/string.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/zencore/include/zencore/string.h b/zencore/include/zencore/string.h index df78b2757..dba6843cf 100644 --- a/zencore/include/zencore/string.h +++ b/zencore/include/zencore/string.h @@ -665,8 +665,8 @@ template<typename Fn> uint32_t ForEachStrTok(const std::string_view& Str, char Delim, Fn&& Func) { - auto It = Str.begin(); - auto End = Str.end(); + const char* It = Str.data(); + const char* End = It + Str.length(); uint32_t Count = 0; while (It != End) @@ -677,7 +677,7 @@ ForEachStrTok(const std::string_view& Str, char Delim, Fn&& Func) continue; } - std::string_view Remaining{It, End}; + std::string_view Remaining{It, size_t(ptrdiff_t(End - It))}; size_t Idx = Remaining.find(Delim, 0); if (Idx == std::string_view::npos) @@ -686,7 +686,7 @@ ForEachStrTok(const std::string_view& Str, char Delim, Fn&& Func) } Count++; - std::string_view Token{It, It + Idx}; + std::string_view Token{It, Idx}; if (!Func(Token)) { break; |