Minor string optimizations.

This commit is contained in:
Stephen Anthony 2022-12-30 18:00:37 -03:30
parent 9cc804d0e0
commit 89fb53a510
2 changed files with 4 additions and 2 deletions

View File

@ -427,7 +427,8 @@ namespace BSPF
inline bool isWhiteSpace(const char c)
{
return string(" ,.;:+-*&/\\'").find(c) != string::npos;
static constexpr string_view spaces{" ,.;:+-*&/\\'"};
return spaces.find(c) != string_view::npos;
}
} // namespace BSPF

View File

@ -411,7 +411,8 @@ class FBSurface
@return True if whitespace character
*/
static bool isWhiteSpace(const char c) {
return string(" ,.;:+-*/\\'([\n").find(c) != string::npos;
static constexpr string_view spaces{" ,.;:+-*/\\'([\n"};
return spaces.find(c) != string_view::npos;
}
protected: