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
@ -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) {
|
||||
bindings.emplace(name, Binding(type, code));
|
||||
bindings.try_emplace(name, Binding(type, code));
|
||||
}
|
||||
|
||||
void Events::rebind(const std::string& name, inputtype type, int code) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user