From d7be2c60100c794caeddb5b4e8acbed43fa3df26 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 2 Jan 2021 14:50:28 +0100 Subject: Use std::all_of --- include/raul/Symbol.hpp | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'include/raul') diff --git a/include/raul/Symbol.hpp b/include/raul/Symbol.hpp index 30917b5..5794440 100644 --- a/include/raul/Symbol.hpp +++ b/include/raul/Symbol.hpp @@ -18,6 +18,7 @@ #include "raul/Exception.hpp" +#include #include #include @@ -99,13 +100,7 @@ public: return false; // Must start with a letter or underscore } - for (auto c : str) { - if (!is_valid_char(c)) { - return false; // All characters must be _, a-z, A-Z, 0-9 - } - } - - return true; + return std::all_of(str.begin(), str.end(), is_valid_char); } /** Convert a string to a valid symbol. -- cgit v1.2.1