diff options
| author | Lioncash <mathew1800@gmail.com> | 2019-05-29 06:12:27 -0400 |
|---|---|---|
| committer | Lioncash <mathew1800@gmail.com> | 2019-05-29 06:12:29 -0400 |
| commit | 50a15b7484af90441f556bb0febd87b41818c5b6 (patch) | |
| tree | 14289b3426aed1162f7a45cb76de148adbe4aa31 /Source/Core/VideoCommon/NetPlayChatUI.cpp | |
| parent | 08223bad9f46f6c23bac915ae8d41eb7eac71b64 (diff) | |
VideoCommon/NetPlayChatUI: Take std::string by value in AppendChat()
Given we're simply storing the std::string into a deque. We can emplace
it and move it. Completely avoiding copies with the current usage of the
function.
Diffstat (limited to 'Source/Core/VideoCommon/NetPlayChatUI.cpp')
| -rw-r--r-- | Source/Core/VideoCommon/NetPlayChatUI.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Source/Core/VideoCommon/NetPlayChatUI.cpp b/Source/Core/VideoCommon/NetPlayChatUI.cpp index 29becc020f..6c8bce9227 100644 --- a/Source/Core/VideoCommon/NetPlayChatUI.cpp +++ b/Source/Core/VideoCommon/NetPlayChatUI.cpp @@ -78,12 +78,12 @@ void NetPlayChatUI::Display() ImGui::End(); } -void NetPlayChatUI::AppendChat(const std::string& message, NetPlayChatUI::Color color) +void NetPlayChatUI::AppendChat(std::string message, Color color) { if (m_messages.size() > MAX_BACKLOG_SIZE) m_messages.pop_front(); - m_messages.push_back({message, color}); + m_messages.emplace_back(std::move(message), color); // Only scroll to bottom, if we were at the bottom previously if (m_is_scrolled_to_bottom) |
