From 2718f2c4287d7a3e51e42e4d46c927d40d0a6c2e Mon Sep 17 00:00:00 2001 From: Ioannis Magkanaris Date: Tue, 12 Sep 2023 14:57:53 +0200 Subject: [PATCH] Use std::any_of with lamda --- src/codegen/codegen_cpp_visitor.hpp | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/codegen/codegen_cpp_visitor.hpp b/src/codegen/codegen_cpp_visitor.hpp index 8366ffc32f..f9c3a56984 100644 --- a/src/codegen/codegen_cpp_visitor.hpp +++ b/src/codegen/codegen_cpp_visitor.hpp @@ -1890,15 +1890,11 @@ void CodegenCppVisitor::print_vector_elements(const std::vector& elements, template bool has_parameter_of_name(const T& node, const std::string& name) { auto parameters = node->get_parameters(); - struct ParameterHasName { - const std::string paramater_name; - explicit ParameterHasName(const std::string& name) - : paramater_name(name) {} - bool operator()(const decltype(*parameters.begin()) arg) const { - return arg->get_node_name() == paramater_name; - } - }; - return std::any_of(parameters.begin(), parameters.end(), ParameterHasName(name)); + return std::any_of(parameters.begin(), + parameters.end(), + [&name](const decltype(*parameters.begin()) arg) { + return arg->get_node_name() == name; + }); }