brbzull0 commented on code in PR #13904:
URL: https://github.com/apache/trafficserver/pull/13904#discussion_r4376455624


##########
src/mgmt/config/ConfigContext.cc:
##########
@@ -168,7 +175,10 @@ ConfigContext::add_dependent_ctx(std::string_view 
description, std::string_view
 void
 ConfigContext::set_supplied_yaml(YAML::Node node)
 {
-  _supplied_yaml = node; // YAML::Node has no move semantics; copy is cheap 
(ref-counted).
+  auto next = _payload ? std::make_shared<Payload>(*_payload) : 
std::make_shared<Payload>();
+  // emplace() copy-constructs the node; assigning into an engaged optional 
would write through.
+  next->supplied_yaml.emplace(node); // YAML::Node has no move semantics; copy 
is cheap (ref-counted).

Review Comment:
   No change: `YAML::Node` has no move constructor. It declares `Node(const 
Node&)` and `~Node()` (`include/yaml-cpp/node/node.h` in yaml-cpp 0.8.0, 0.9.0 
and master), so no move constructor is generated and `std::move(node)` would 
still copy. The comment is accurate.
   



-- 
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