diff options
author | Lioncash <mathew1800@gmail.com> | 2021-12-13 11:36:48 -0500 |
---|---|---|
committer | Lioncash <mathew1800@gmail.com> | 2021-12-13 11:45:19 -0500 |
commit | 54ca48e8b772453814d2e4d49a4ba29a1b46b32d (patch) | |
tree | b8dae22038a45e49c8e318a8991e2f6e89ad752c /src/input_common/drivers/tas_input.cpp | |
parent | 734fb180bb42d361f05d1fab02323de5095e2d8d (diff) |
tas_input: Avoid minor copies in Read/WriteCommandButtons()
We don't need to copy the whole pair
Diffstat (limited to 'src/input_common/drivers/tas_input.cpp')
-rw-r--r-- | src/input_common/drivers/tas_input.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/input_common/drivers/tas_input.cpp b/src/input_common/drivers/tas_input.cpp index 1617ba1d47..2094c1feba 100644 --- a/src/input_common/drivers/tas_input.cpp +++ b/src/input_common/drivers/tas_input.cpp @@ -244,7 +244,7 @@ u64 Tas::ReadCommandButtons(const std::string& line) const { std::string button_line; u64 buttons = 0; while (std::getline(button_text, button_line, ';')) { - for (auto [text, tas_button] : text_to_tas_button) { + for (const auto& [text, tas_button] : text_to_tas_button) { if (text == button_line) { buttons |= static_cast<u64>(tas_button); break; @@ -256,7 +256,7 @@ u64 Tas::ReadCommandButtons(const std::string& line) const { std::string Tas::WriteCommandButtons(u64 buttons) const { std::string returns; - for (auto [text_button, tas_button] : text_to_tas_button) { + for (const auto& [text_button, tas_button] : text_to_tas_button) { if ((buttons & static_cast<u64>(tas_button)) != 0) { returns += fmt::format("{};", text_button); } |