diff --git a/src/SFML/Audio/AudioDevice.cpp b/src/SFML/Audio/AudioDevice.cpp index 87315c5c2..8c8ba19ea 100644 --- a/src/SFML/Audio/AudioDevice.cpp +++ b/src/SFML/Audio/AudioDevice.cpp @@ -29,7 +29,7 @@ #include #include #include -#include +#include namespace @@ -107,13 +107,9 @@ bool AudioDevice::isExtensionSupported(const std::string& extension) // This device will not be used in this function and merely // makes sure there is a valid OpenAL device for extension // queries if none has been created yet. - // - // Using an std::vector for this since auto_ptr is deprecated - // and we have no better STL facility for dynamically allocating - // a temporary instance with strong exception guarantee. - std::vector device; + std::optional device; if (!audioDevice) - device.resize(1); + device.emplace(); if ((extension.length() > 2) && (extension.substr(0, 3) == "ALC")) return alcIsExtensionPresent(audioDevice, extension.c_str()) != AL_FALSE; @@ -129,13 +125,9 @@ int AudioDevice::getFormatFromChannelCount(unsigned int channelCount) // This device will not be used in this function and merely // makes sure there is a valid OpenAL device for format // queries if none has been created yet. - // - // Using an std::vector for this since auto_ptr is deprecated - // and we have no better STL facility for dynamically allocating - // a temporary instance with strong exception guarantee. - std::vector device; + std::optional device; if (!audioDevice) - device.resize(1); + device.emplace(); // Find the good format according to the number of channels int format = 0;