mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-08 12:31:51 +00:00
fix: optimization: PVS-Studio warning V837
Replaced 'emplace' with 'try_emplace' to avoid unnecessary copies or moves when insertion fails. The 'emplace' function does not guarantee that arguments will not be copied or moved if insertion is not successful. Using 'try_emplace' ensures that arguments are only copied or moved if the insertion actually takes place, thus improving performance. Reported by: PVS-Studio Signed-off-by: Vyacheslav Ivanov <islavaivanov76@gmail.com>
This commit is contained in:
parent
a20ffee7cb
commit
63ede5e27d
1 changed files with 1 additions and 1 deletions
|
|
@ -115,7 +115,7 @@ void Events::bind(const std::string& name, inputtype type, mousecode code) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Events::bind(const std::string& name, inputtype type, int code) {
|
void Events::bind(const std::string& name, inputtype type, int code) {
|
||||||
bindings.emplace(name, Binding(type, code));
|
bindings.try_emplace(name, Binding(type, code));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Events::rebind(const std::string& name, inputtype type, int code) {
|
void Events::rebind(const std::string& name, inputtype type, int code) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue