GraphicsModGroup: Reduce object churn

We can emplace and move to avoid doing object copies.
This commit is contained in:
Lioncash 2024-01-24 22:40:03 -05:00
parent e3e20df185
commit 0327b11e0b
2 changed files with 4 additions and 4 deletions

View File

@ -18,7 +18,7 @@
#include "VideoCommon/GraphicsModSystem/Constants.h"
#include "VideoCommon/HiresTextures.h"
GraphicsModGroupConfig::GraphicsModGroupConfig(const std::string& game_id) : m_game_id(game_id)
GraphicsModGroupConfig::GraphicsModGroupConfig(std::string game_id) : m_game_id(std::move(game_id))
{
}
@ -145,9 +145,9 @@ void GraphicsModGroupConfig::Save() const
{
picojson::object serialized_mod;
mod.SerializeToProfile(&serialized_mod);
serialized_mods.push_back(picojson::value{serialized_mod});
serialized_mods.emplace_back(std::move(serialized_mod));
}
serialized_root["mods"] = picojson::value{serialized_mods};
serialized_root.emplace("mods", std::move(serialized_mods));
const auto output = picojson::value{serialized_root}.serialize(true);
json_stream << output;

View File

@ -16,7 +16,7 @@ struct GraphicsModConfig;
class GraphicsModGroupConfig
{
public:
explicit GraphicsModGroupConfig(const std::string& game_id);
explicit GraphicsModGroupConfig(std::string game_id);
~GraphicsModGroupConfig();
GraphicsModGroupConfig(const GraphicsModGroupConfig&);