From dd83189faea4e2c8f6017b09697ec1edf8a5eca3 Mon Sep 17 00:00:00 2001 From: Chris Thrasher Date: Thu, 22 Dec 2022 22:56:59 -0600 Subject: [PATCH] Enable move semantics for SoundFile types Funny how the addition of a forward declaration resulted in accidentally disabling move semantics for two types. We ought to be careful that build time improvements don't have runtime performance impacts. --- include/SFML/Audio/InputSoundFile.hpp | 9 ++------- include/SFML/Audio/OutputSoundFile.hpp | 12 ++---------- src/SFML/Audio/InputSoundFile.cpp | 4 ---- src/SFML/Audio/OutputSoundFile.cpp | 4 ---- test/Audio/InputSoundFile.test.cpp | 4 ++-- test/Audio/OutputSoundFile.test.cpp | 4 ++-- 6 files changed, 8 insertions(+), 29 deletions(-) diff --git a/include/SFML/Audio/InputSoundFile.hpp b/include/SFML/Audio/InputSoundFile.hpp index 7cd787d3..895d073c 100644 --- a/include/SFML/Audio/InputSoundFile.hpp +++ b/include/SFML/Audio/InputSoundFile.hpp @@ -29,6 +29,8 @@ //////////////////////////////////////////////////////////// #include +#include + #include #include #include @@ -39,7 +41,6 @@ namespace sf { class Time; class InputStream; -class SoundFileReader; //////////////////////////////////////////////////////////// /// \brief Provide read access to sound files @@ -54,12 +55,6 @@ public: //////////////////////////////////////////////////////////// InputSoundFile(); - //////////////////////////////////////////////////////////// - /// \brief Destructor - /// - //////////////////////////////////////////////////////////// - ~InputSoundFile(); - //////////////////////////////////////////////////////////// /// \brief Open a sound file from the disk for reading /// diff --git a/include/SFML/Audio/OutputSoundFile.hpp b/include/SFML/Audio/OutputSoundFile.hpp index f1aaab2d..26497f0b 100644 --- a/include/SFML/Audio/OutputSoundFile.hpp +++ b/include/SFML/Audio/OutputSoundFile.hpp @@ -29,6 +29,8 @@ //////////////////////////////////////////////////////////// #include +#include + #include #include #include @@ -36,8 +38,6 @@ namespace sf { -class SoundFileWriter; - //////////////////////////////////////////////////////////// /// \brief Provide write access to sound files /// @@ -51,14 +51,6 @@ public: //////////////////////////////////////////////////////////// OutputSoundFile(); - //////////////////////////////////////////////////////////// - /// \brief Destructor - /// - /// Closes the file if it was still open. - /// - //////////////////////////////////////////////////////////// - ~OutputSoundFile(); - //////////////////////////////////////////////////////////// /// \brief Open the sound file from the disk for writing /// diff --git a/src/SFML/Audio/InputSoundFile.cpp b/src/SFML/Audio/InputSoundFile.cpp index 258eacf5..2719ff66 100644 --- a/src/SFML/Audio/InputSoundFile.cpp +++ b/src/SFML/Audio/InputSoundFile.cpp @@ -65,10 +65,6 @@ void InputSoundFile::StreamDeleter::operator()(InputStream* ptr) const InputSoundFile::InputSoundFile() = default; -//////////////////////////////////////////////////////////// -InputSoundFile::~InputSoundFile() = default; - - //////////////////////////////////////////////////////////// bool InputSoundFile::openFromFile(const std::filesystem::path& filename) { diff --git a/src/SFML/Audio/OutputSoundFile.cpp b/src/SFML/Audio/OutputSoundFile.cpp index 4222ca80..337f7383 100644 --- a/src/SFML/Audio/OutputSoundFile.cpp +++ b/src/SFML/Audio/OutputSoundFile.cpp @@ -36,10 +36,6 @@ namespace sf OutputSoundFile::OutputSoundFile() = default; -//////////////////////////////////////////////////////////// -OutputSoundFile::~OutputSoundFile() = default; - - //////////////////////////////////////////////////////////// bool OutputSoundFile::openFromFile(const std::filesystem::path& filename, unsigned int sampleRate, unsigned int channelCount) { diff --git a/test/Audio/InputSoundFile.test.cpp b/test/Audio/InputSoundFile.test.cpp index 28a2758a..e6e3e1e3 100644 --- a/test/Audio/InputSoundFile.test.cpp +++ b/test/Audio/InputSoundFile.test.cpp @@ -4,5 +4,5 @@ static_assert(!std::is_copy_constructible_v); static_assert(!std::is_copy_assignable_v); -static_assert(!std::is_nothrow_move_constructible_v); -static_assert(!std::is_nothrow_move_assignable_v); +static_assert(std::is_nothrow_move_constructible_v); +static_assert(std::is_nothrow_move_assignable_v); diff --git a/test/Audio/OutputSoundFile.test.cpp b/test/Audio/OutputSoundFile.test.cpp index a2a259e1..765e79dd 100644 --- a/test/Audio/OutputSoundFile.test.cpp +++ b/test/Audio/OutputSoundFile.test.cpp @@ -4,5 +4,5 @@ static_assert(!std::is_copy_constructible_v); static_assert(!std::is_copy_assignable_v); -static_assert(!std::is_nothrow_move_constructible_v); -static_assert(!std::is_nothrow_move_assignable_v); +static_assert(std::is_nothrow_move_constructible_v); +static_assert(std::is_nothrow_move_assignable_v);