From 15397e2a8909eb226e169d496852b6e5625fc4fb Mon Sep 17 00:00:00 2001 From: Lioncash Date: Fri, 31 May 2019 07:03:52 -0400 Subject: [PATCH] AudioCommon: Use emplace_back instead of push_back in GetSoundBackends() Constructs the strings directly within the container instead of performing a construction, then a copy. The reasoning is that the BACKEND_* strings are const char arrays, so the push_back code is equivalent to: push_back(std::string(BACKEND_WHATEVER)) instead of forwarding the arguments to a constructed instance directly in the container. --- Source/Core/AudioCommon/AudioCommon.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Source/Core/AudioCommon/AudioCommon.cpp b/Source/Core/AudioCommon/AudioCommon.cpp index 79a89f83f9..ec68ef87aa 100644 --- a/Source/Core/AudioCommon/AudioCommon.cpp +++ b/Source/Core/AudioCommon/AudioCommon.cpp @@ -99,20 +99,20 @@ std::vector GetSoundBackends() { std::vector backends; - backends.push_back(BACKEND_NULLSOUND); - backends.push_back(BACKEND_CUBEB); + backends.emplace_back(BACKEND_NULLSOUND); + backends.emplace_back(BACKEND_CUBEB); if (XAudio2_7::isValid() || XAudio2::isValid()) - backends.push_back(BACKEND_XAUDIO2); + backends.emplace_back(BACKEND_XAUDIO2); if (AlsaSound::isValid()) - backends.push_back(BACKEND_ALSA); + backends.emplace_back(BACKEND_ALSA); if (PulseAudio::isValid()) - backends.push_back(BACKEND_PULSEAUDIO); + backends.emplace_back(BACKEND_PULSEAUDIO); if (OpenALStream::isValid()) - backends.push_back(BACKEND_OPENAL); + backends.emplace_back(BACKEND_OPENAL); if (OpenSLESStream::isValid()) - backends.push_back(BACKEND_OPENSLES); + backends.emplace_back(BACKEND_OPENSLES); if (WASAPIStream::isValid()) - backends.push_back(BACKEND_WASAPI); + backends.emplace_back(BACKEND_WASAPI); return backends; }