mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-05 11:01: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
|
|
@ -4,6 +4,7 @@
|
|||
#include "../util/stringutil.hpp"
|
||||
|
||||
#include <iostream>
|
||||
#include <utility>
|
||||
|
||||
using namespace cmd;
|
||||
|
||||
|
|
@ -156,7 +157,7 @@ public:
|
|||
}
|
||||
return Command(
|
||||
name, std::move(args), std::move(kwargs),
|
||||
std::string(description), executor
|
||||
std::string(description), std::move(executor)
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -256,7 +257,7 @@ public:
|
|||
dynamic::Value applyRelative(
|
||||
Argument* arg,
|
||||
dynamic::Value value,
|
||||
dynamic::Value origin
|
||||
const dynamic::Value& origin
|
||||
) {
|
||||
if (origin.index() == 0) {
|
||||
return value;
|
||||
|
|
@ -380,7 +381,7 @@ public:
|
|||
};
|
||||
|
||||
Command Command::create(std::string_view scheme, std::string_view description, executor_func executor) {
|
||||
return CommandParser("<string>", scheme).parseScheme(executor, description);
|
||||
return CommandParser("<string>", scheme).parseScheme(std::move(executor), description);
|
||||
}
|
||||
|
||||
void CommandsRepository::add(
|
||||
|
|
@ -388,7 +389,7 @@ void CommandsRepository::add(
|
|||
std::string_view description,
|
||||
executor_func executor
|
||||
) {
|
||||
Command command = Command::create(scheme, description, executor);
|
||||
Command command = Command::create(scheme, description, std::move(executor));
|
||||
commands[command.getName()] = command;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue