SysConf: std::move name in Entry constructor

Allows code to move into the constructor, avoiding copies entirely.
This commit is contained in:
Lioncash 2020-12-29 19:09:54 -05:00
parent 05094ab51f
commit 1bbfde62d1
2 changed files with 5 additions and 5 deletions

View File

@ -211,14 +211,14 @@ bool SysConf::Save() const
return result == IOS::HLE::FS::ResultCode::Success;
}
SysConf::Entry::Entry(Type type_, const std::string& name_) : type(type_), name(name_)
SysConf::Entry::Entry(Type type_, std::string name_) : type(type_), name(std::move(name_))
{
if (type != Type::SmallArray && type != Type::BigArray)
bytes.resize(GetNonArrayEntrySize(type));
}
SysConf::Entry::Entry(Type type_, const std::string& name_, std::vector<u8> bytes_)
: type(type_), name(name_), bytes(std::move(bytes_))
SysConf::Entry::Entry(Type type_, std::string name_, std::vector<u8> bytes_)
: type(type_), name(std::move(name_)), bytes(std::move(bytes_))
{
}

View File

@ -47,8 +47,8 @@ public:
ByteBool = 7,
};
Entry(Type type_, const std::string& name_);
Entry(Type type_, const std::string& name_, std::vector<u8> bytes_);
Entry(Type type_, std::string name_);
Entry(Type type_, std::string name_, std::vector<u8> bytes_);
// Intended for use with the non array types.
template <typename T>