fix: optimization: PVS-Studio warning V813

Passing large objects by const reference avoids unnecessary copying and enhances efficiency.

Reported by: PVS-Studio
Signed-off-by: Vyacheslav Ivanov <islavaivanov76@gmail.com>
This commit is contained in:
Vyacheslav Ivanov
2024-08-02 05:35:55 +03:00
committed by Pugemon
parent 5b325ac2bc
commit 2c1103307f
42 changed files with 173 additions and 144 deletions
+10 -10
View File
@@ -118,34 +118,34 @@ namespace dynamic {
List_sptr list(const std::string& key) const;
void flag(const std::string& key, bool& dst) const;
Map& put(std::string key, std::unique_ptr<Map> value) {
Map& put(const std::string& key, std::unique_ptr<Map> value) {
return put(key, Map_sptr(value.release()));
}
Map& put(std::string key, std::unique_ptr<List> value) {
Map& put(const std::string& key, std::unique_ptr<List> value) {
return put(key, List_sptr(value.release()));
}
Map& put(std::string key, int value) {
Map& put(const std::string& key, int value) {
return put(key, Value(static_cast<integer_t>(value)));
}
Map& put(std::string key, unsigned int value) {
Map& put(const std::string& key, unsigned int value) {
return put(key, Value(static_cast<integer_t>(value)));
}
Map& put(std::string key, int64_t value) {
Map& put(const std::string& key, int64_t value) {
return put(key, Value(static_cast<integer_t>(value)));
}
Map& put(std::string key, uint64_t value) {
Map& put(const std::string& key, uint64_t value) {
return put(key, Value(static_cast<integer_t>(value)));
}
Map& put(std::string key, float value) {
Map& put(const std::string& key, float value) {
return put(key, Value(static_cast<number_t>(value)));
}
Map& put(std::string key, double value) {
Map& put(const std::string& key, double value) {
return put(key, Value(static_cast<number_t>(value)));
}
Map& put(std::string key, bool value) {
Map& put(const std::string& key, bool value) {
return put(key, Value(static_cast<bool>(value)));
}
Map& put(std::string key, const char* value) {
Map& put(const std::string& key, const char* value) {
return put(key, Value(value));
}
Map& put(const std::string& key, const Value& value);