From 887032881a93fe37d576450589249c17bb9ff231 Mon Sep 17 00:00:00 2001 From: Dennis Luxen Date: Thu, 22 Jan 2015 15:09:24 +0100 Subject: [PATCH] use std::any_of() algorithm instead of hand-rolled logic --- extractor/restriction_parser.cpp | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/extractor/restriction_parser.cpp b/extractor/restriction_parser.cpp index dd4855508..7965e78ec 100644 --- a/extractor/restriction_parser.cpp +++ b/extractor/restriction_parser.cpp @@ -39,6 +39,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include +#include + namespace { int lua_error_callback(lua_State *lua_state) @@ -228,14 +230,16 @@ bool RestrictionParser::ShouldIgnoreRestriction(const std::string &except_tag_st // only a few exceptions are actually defined. std::vector exceptions; boost::algorithm::split_regex(exceptions, except_tag_string, boost::regex("[;][ ]*")); - for (std::string ¤t_string : exceptions) - { - const auto string_iterator = - std::find(restriction_exceptions.begin(), restriction_exceptions.end(), current_string); - if (restriction_exceptions.end() != string_iterator) - { - return true; - } - } - return false; + + return std::any_of(std::begin(exceptions), std::end(exceptions), + [&](const std::string ¤t_string) + { + if (restriction_exceptions.end() != + std::find(restriction_exceptions.begin(), + restriction_exceptions.end(), current_string)) + { + return true; + } + return false; + }); }