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.
This commit is contained in:
Lioncash 2019-05-31 07:03:52 -04:00
parent 1a56e9d9e0
commit 15397e2a89
1 changed files with 8 additions and 8 deletions

View File

@ -99,20 +99,20 @@ std::vector<std::string> GetSoundBackends()
{
std::vector<std::string> 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;
}