lordgamez commented on code in PR #1915:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1915#discussion_r2043845743


##########
libminifi/src/core/yaml/YamlFlowSerializer.cpp:
##########
@@ -72,7 +62,19 @@ void 
YamlFlowSerializer::addProviderCreatedParameterContexts(YAML::Node flow_def
     }
 
     parameter_context_node[schema.parameters[0]] = parameters_node;
-    parameter_contexts_node.push_back(parameter_context_node);
+
+    int64_t index = -1;
+    for (int64_t i = 0; i < 
gsl::narrow<int64_t>(parameter_contexts_node.size()); ++i) {
+      if (parameter_contexts_node[i][schema.name[0]].as<std::string>() == 
parameter_context->getName()) {
+        index = i;
+        break;
+      }
+    }

Review Comment:
   Unfortunately I could not use `find_if` here similarly to the json 
serializer, because yamlcpp's iterator does not support assignment, so I had to 
find the index here instead.
   ```
   YamlFlowSerializer.cpp:71:13: error: no match for ‘operator=’ (operand types 
are ‘YAML::detail::iterator_base<YAML::detail::iterator_value>::value_type’ 
{aka ‘YAML::detail::iterator_value’} and ‘YAML::Node’)
      71 |       *it = parameter_context_node;
         |             ^~~~~~~~~~~~~~~~~~~~~~
   
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to