diff --git a/include/SFML/Audio/SoundFileFactory.hpp b/include/SFML/Audio/SoundFileFactory.hpp index 61c8cfac3..3e10ee5dc 100644 --- a/include/SFML/Audio/SoundFileFactory.hpp +++ b/include/SFML/Audio/SoundFileFactory.hpp @@ -29,6 +29,7 @@ //////////////////////////////////////////////////////////// #include +#include #include #include #include diff --git a/include/SFML/Audio/SoundFileFactory.inl b/include/SFML/Audio/SoundFileFactory.inl index f2f134ae0..09910e44d 100644 --- a/include/SFML/Audio/SoundFileFactory.inl +++ b/include/SFML/Audio/SoundFileFactory.inl @@ -63,13 +63,11 @@ template void SoundFileFactory::unregisterReader() { // Remove the instance(s) of the reader from the array of factories - for (auto it = s_readers.begin(); it != s_readers.end(); /* noop */) - { - if (it->create == &priv::createReader) - it = s_readers.erase(it); - else - ++it; - } + s_readers.erase(std::remove_if(s_readers.begin(), + s_readers.end(), + [](const ReaderFactory& readerFactory) + { return readerFactory.create == &priv::createReader; }), + s_readers.end()); } //////////////////////////////////////////////////////////// @@ -92,13 +90,11 @@ template void SoundFileFactory::unregisterWriter() { // Remove the instance(s) of the writer from the array of factories - for (auto it = s_writers.begin(); it != s_writers.end(); /* noop */) - { - if (it->create == &priv::createWriter) - it = s_writers.erase(it); - else - ++it; - } + s_writers.erase(std::remove_if(s_writers.begin(), + s_writers.end(), + [](const WriterFactory& writerFactory) + { return writerFactory.create == &priv::createWriter; }), + s_writers.end()); } } // namespace sf diff --git a/src/SFML/Window/Win32/JoystickImpl.cpp b/src/SFML/Window/Win32/JoystickImpl.cpp index 7454ddd4f..6e952dbdf 100644 --- a/src/SFML/Window/Win32/JoystickImpl.cpp +++ b/src/SFML/Window/Win32/JoystickImpl.cpp @@ -496,13 +496,10 @@ void JoystickImpl::updateConnectionsDInput() DIEDFL_ATTACHEDONLY); // Remove devices that were not connected during the enumeration - for (auto i = joystickList.begin(); i != joystickList.end();) - { - if (!i->plugged) - i = joystickList.erase(i); - else - ++i; - } + joystickList.erase(std::remove_if(joystickList.begin(), + joystickList.end(), + [](const JoystickRecord& joystickRecord) { return !joystickRecord.plugged; }), + joystickList.end()); if (FAILED(result)) {