mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-05 02:51:49 +00:00
Optimize parameter passing to avoid unnecessary copying
This commit is contained in:
parent
46ca1bb04a
commit
f25a425cb9
123 changed files with 578 additions and 522 deletions
|
|
@ -110,7 +110,7 @@ void Map::str(const std::string& key, std::string& dst) const {
|
|||
dst = get(key, dst);
|
||||
}
|
||||
|
||||
std::string Map::get(const std::string& key, const std::string def) const {
|
||||
std::string Map::get(const std::string& key, const std::string& def) const {
|
||||
auto found = values.find(key);
|
||||
if (found == values.end())
|
||||
return def;
|
||||
|
|
@ -213,7 +213,7 @@ void Map::flag(const std::string& key, bool& dst) const {
|
|||
dst = get(key, dst);
|
||||
}
|
||||
|
||||
Map& Map::put(std::string key, const Value& value) {
|
||||
Map& Map::put(const std::string& key, const Value& value) {
|
||||
values[key] = value;
|
||||
return *this;
|
||||
}
|
||||
|
|
@ -222,13 +222,13 @@ void Map::remove(const std::string& key) {
|
|||
values.erase(key);
|
||||
}
|
||||
|
||||
List& Map::putList(std::string key) {
|
||||
List& Map::putList(const std::string& key) {
|
||||
auto arr = create_list();
|
||||
put(key, arr);
|
||||
return *arr;
|
||||
}
|
||||
|
||||
Map& Map::putMap(std::string key) {
|
||||
Map& Map::putMap(const std::string& key) {
|
||||
auto obj = create_map();
|
||||
put(key, obj);
|
||||
return *obj;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue