summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLioncash <mathew1800@gmail.com>2018-07-20 23:17:26 +0200
committerLioncash <mathew1800@gmail.com>2018-07-20 23:24:06 +0200
commit3268321f4be987aab18c14f3b3ee478f46c7fe38 (patch)
treec74af88f19aa1e0e6215f9c33becbf38eb3f2149
parentparam_package: Use std::unordered_map's insert_or_assign instead of map indexing (diff)
downloadyuzu-3268321f4be987aab18c14f3b3ee478f46c7fe38.tar
yuzu-3268321f4be987aab18c14f3b3ee478f46c7fe38.tar.gz
yuzu-3268321f4be987aab18c14f3b3ee478f46c7fe38.tar.bz2
yuzu-3268321f4be987aab18c14f3b3ee478f46c7fe38.tar.lz
yuzu-3268321f4be987aab18c14f3b3ee478f46c7fe38.tar.xz
yuzu-3268321f4be987aab18c14f3b3ee478f46c7fe38.tar.zst
yuzu-3268321f4be987aab18c14f3b3ee478f46c7fe38.zip
-rw-r--r--src/common/param_package.cpp8
-rw-r--r--src/common/param_package.h2
2 files changed, 6 insertions, 4 deletions
diff --git a/src/common/param_package.cpp b/src/common/param_package.cpp
index 02399b336..9526ca0c6 100644
--- a/src/common/param_package.cpp
+++ b/src/common/param_package.cpp
@@ -3,7 +3,9 @@
// Refer to the license.txt file included.
#include <array>
+#include <utility>
#include <vector>
+
#include "common/logging/log.h"
#include "common/param_package.h"
#include "common/string_util.h"
@@ -36,7 +38,7 @@ ParamPackage::ParamPackage(const std::string& serialized) {
part = Common::ReplaceAll(part, ESCAPE_CHARACTER_ESCAPE, {ESCAPE_CHARACTER});
}
- Set(key_value[0], key_value[1]);
+ Set(key_value[0], std::move(key_value[1]));
}
}
@@ -102,8 +104,8 @@ float ParamPackage::Get(const std::string& key, float default_value) const {
}
}
-void ParamPackage::Set(const std::string& key, const std::string& value) {
- data.insert_or_assign(key, value);
+void ParamPackage::Set(const std::string& key, std::string value) {
+ data.insert_or_assign(key, std::move(value));
}
void ParamPackage::Set(const std::string& key, int value) {
diff --git a/src/common/param_package.h b/src/common/param_package.h
index c4c11b221..7842cd4ef 100644
--- a/src/common/param_package.h
+++ b/src/common/param_package.h
@@ -28,7 +28,7 @@ public:
std::string Get(const std::string& key, const std::string& default_value) const;
int Get(const std::string& key, int default_value) const;
float Get(const std::string& key, float default_value) const;
- void Set(const std::string& key, const std::string& value);
+ void Set(const std::string& key, std::string value);
void Set(const std::string& key, int value);
void Set(const std::string& key, float value);
bool Has(const std::string& key) const;