diff options
author | Rosen Penev <rosenp@gmail.com> | 2020-03-26 21:29:30 -0700 |
---|---|---|
committer | Rosen Penev <rosenp@gmail.com> | 2020-04-08 14:01:12 -0700 |
commit | 015cbff93dafb17f748a20c806f4a73084a4635e (patch) | |
tree | 397288038526bf9d835ba92b00604ab51f9eb89b /src/command | |
parent | 3540cf26b1b342f175255f2dc02e615483a1383c (diff) |
[cppcheck] convert several functions to use std::all_of
std::all_of becomes constexpr in C++20. I'm not sure it results in better
performance.
Found with useStlAlgorithm
Signed-off-by: Rosen Penev <rosenp@gmail.com>
Diffstat (limited to 'src/command')
-rw-r--r-- | src/command/FileCommands.cxx | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/src/command/FileCommands.cxx b/src/command/FileCommands.cxx index d8be0da4a..ebe229ebd 100644 --- a/src/command/FileCommands.cxx +++ b/src/command/FileCommands.cxx @@ -127,12 +127,7 @@ gcc_pure static bool IsValidValue(const StringView s) noexcept { - for (const char ch : s) { - if ((unsigned char)ch < 0x20) - return false; - } - - return true; + return std::none_of(s.begin(), s.end(), [](const auto &ch) { return (unsigned char)ch < 0x20; }); } class PrintCommentHandler final : public NullTagHandler { |