use std::any_of() algorithm instead of hand-rolled logic
This commit is contained in:
parent
e67f82283f
commit
887032881a
@ -39,6 +39,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
#include <boost/ref.hpp>
|
#include <boost/ref.hpp>
|
||||||
#include <boost/regex.hpp>
|
#include <boost/regex.hpp>
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
int lua_error_callback(lua_State *lua_state)
|
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.
|
// only a few exceptions are actually defined.
|
||||||
std::vector<std::string> exceptions;
|
std::vector<std::string> exceptions;
|
||||||
boost::algorithm::split_regex(exceptions, except_tag_string, boost::regex("[;][ ]*"));
|
boost::algorithm::split_regex(exceptions, except_tag_string, boost::regex("[;][ ]*"));
|
||||||
for (std::string ¤t_string : exceptions)
|
|
||||||
|
return std::any_of(std::begin(exceptions), std::end(exceptions),
|
||||||
|
[&](const std::string ¤t_string)
|
||||||
{
|
{
|
||||||
const auto string_iterator =
|
if (restriction_exceptions.end() !=
|
||||||
std::find(restriction_exceptions.begin(), restriction_exceptions.end(), current_string);
|
std::find(restriction_exceptions.begin(),
|
||||||
if (restriction_exceptions.end() != string_iterator)
|
restriction_exceptions.end(), current_string))
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user