From 89c86d71bb0b2ff65c3cc3e6dceabd818a6c4b93 Mon Sep 17 00:00:00 2001 From: Rone Charles Date: Thu, 25 Apr 2024 21:11:09 -0400 Subject: [PATCH] Fix simple test failures --- tokenize.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tokenize.h b/tokenize.h index 976cf9a4..51775c00 100644 --- a/tokenize.h +++ b/tokenize.h @@ -41,7 +41,11 @@ static inline void tokenize( //string::size_type lastPos = s.find_first_not_of(delims, 0); string::size_type lastPos = 0; string::size_type pos = s.find_first_of(delims, lastPos); + while (string::npos != pos || string::npos != lastPos) { + if (pos == string::npos) { + pos = s.size(); + } string::size_type rtrim = pos; while (isspace(s[lastPos])) lastPos++; while (rtrim > 0 && isspace(s[rtrim - 1])) rtrim--;