GraphicsTargetGroup: Reduce object churn a little

This commit is contained in:
Lioncash 2024-01-24 22:51:35 -05:00
parent 24f952c12b
commit 1b7da37114
1 changed files with 6 additions and 6 deletions

View File

@ -12,10 +12,10 @@ void GraphicsTargetGroupConfig::SerializeToConfig(picojson::object& json_obj) co
{ {
picojson::object serialized_target; picojson::object serialized_target;
SerializeTargetToConfig(serialized_target, target); SerializeTargetToConfig(serialized_target, target);
serialized_targets.push_back(picojson::value{serialized_target}); serialized_targets.emplace_back(std::move(serialized_target));
} }
json_obj["targets"] = picojson::value{serialized_targets}; json_obj.emplace("targets", std::move(serialized_targets));
json_obj["name"] = picojson::value{m_name}; json_obj.emplace("name", m_name);
} }
bool GraphicsTargetGroupConfig::DeserializeFromConfig(const picojson::object& obj) bool GraphicsTargetGroupConfig::DeserializeFromConfig(const picojson::object& obj)
@ -72,9 +72,9 @@ void GraphicsTargetGroupConfig::SerializeToProfile(picojson::object* obj) const
{ {
picojson::object serialized_target; picojson::object serialized_target;
SerializeTargetToProfile(&serialized_target, target); SerializeTargetToProfile(&serialized_target, target);
serialized_targets.push_back(picojson::value{serialized_target}); serialized_targets.emplace_back(std::move(serialized_target));
} }
json_obj["targets"] = picojson::value{serialized_targets}; json_obj.emplace("targets", std::move(serialized_targets));
} }
void GraphicsTargetGroupConfig::DeserializeFromProfile(const picojson::object& obj) void GraphicsTargetGroupConfig::DeserializeFromProfile(const picojson::object& obj)
@ -83,7 +83,7 @@ void GraphicsTargetGroupConfig::DeserializeFromProfile(const picojson::object& o
{ {
if (it->second.is<picojson::array>()) if (it->second.is<picojson::array>())
{ {
auto serialized_targets = it->second.get<picojson::array>(); const auto& serialized_targets = it->second.get<picojson::array>();
if (serialized_targets.size() != m_targets.size()) if (serialized_targets.size() != m_targets.size())
return; return;