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.
This commit is contained in:
Chris Thrasher 2022-12-22 22:56:59 -06:00
parent 97adbfa8c7
commit dd83189fae
6 changed files with 8 additions and 29 deletions

View File

@ -29,6 +29,8 @@
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
#include <SFML/Audio/Export.hpp> #include <SFML/Audio/Export.hpp>
#include <SFML/Audio/SoundFileReader.hpp>
#include <cstddef> #include <cstddef>
#include <filesystem> #include <filesystem>
#include <memory> #include <memory>
@ -39,7 +41,6 @@ namespace sf
{ {
class Time; class Time;
class InputStream; class InputStream;
class SoundFileReader;
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Provide read access to sound files /// \brief Provide read access to sound files
@ -54,12 +55,6 @@ public:
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
InputSoundFile(); InputSoundFile();
////////////////////////////////////////////////////////////
/// \brief Destructor
///
////////////////////////////////////////////////////////////
~InputSoundFile();
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Open a sound file from the disk for reading /// \brief Open a sound file from the disk for reading
/// ///

View File

@ -29,6 +29,8 @@
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
#include <SFML/Audio/Export.hpp> #include <SFML/Audio/Export.hpp>
#include <SFML/Audio/SoundFileWriter.hpp>
#include <filesystem> #include <filesystem>
#include <memory> #include <memory>
#include <string> #include <string>
@ -36,8 +38,6 @@
namespace sf namespace sf
{ {
class SoundFileWriter;
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Provide write access to sound files /// \brief Provide write access to sound files
/// ///
@ -51,14 +51,6 @@ public:
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
OutputSoundFile(); OutputSoundFile();
////////////////////////////////////////////////////////////
/// \brief Destructor
///
/// Closes the file if it was still open.
///
////////////////////////////////////////////////////////////
~OutputSoundFile();
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Open the sound file from the disk for writing /// \brief Open the sound file from the disk for writing
/// ///

View File

@ -65,10 +65,6 @@ void InputSoundFile::StreamDeleter::operator()(InputStream* ptr) const
InputSoundFile::InputSoundFile() = default; InputSoundFile::InputSoundFile() = default;
////////////////////////////////////////////////////////////
InputSoundFile::~InputSoundFile() = default;
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
bool InputSoundFile::openFromFile(const std::filesystem::path& filename) bool InputSoundFile::openFromFile(const std::filesystem::path& filename)
{ {

View File

@ -36,10 +36,6 @@ namespace sf
OutputSoundFile::OutputSoundFile() = default; OutputSoundFile::OutputSoundFile() = default;
////////////////////////////////////////////////////////////
OutputSoundFile::~OutputSoundFile() = default;
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
bool OutputSoundFile::openFromFile(const std::filesystem::path& filename, unsigned int sampleRate, unsigned int channelCount) bool OutputSoundFile::openFromFile(const std::filesystem::path& filename, unsigned int sampleRate, unsigned int channelCount)
{ {

View File

@ -4,5 +4,5 @@
static_assert(!std::is_copy_constructible_v<sf::InputSoundFile>); static_assert(!std::is_copy_constructible_v<sf::InputSoundFile>);
static_assert(!std::is_copy_assignable_v<sf::InputSoundFile>); static_assert(!std::is_copy_assignable_v<sf::InputSoundFile>);
static_assert(!std::is_nothrow_move_constructible_v<sf::InputSoundFile>); static_assert(std::is_nothrow_move_constructible_v<sf::InputSoundFile>);
static_assert(!std::is_nothrow_move_assignable_v<sf::InputSoundFile>); static_assert(std::is_nothrow_move_assignable_v<sf::InputSoundFile>);

View File

@ -4,5 +4,5 @@
static_assert(!std::is_copy_constructible_v<sf::OutputSoundFile>); static_assert(!std::is_copy_constructible_v<sf::OutputSoundFile>);
static_assert(!std::is_copy_assignable_v<sf::OutputSoundFile>); static_assert(!std::is_copy_assignable_v<sf::OutputSoundFile>);
static_assert(!std::is_nothrow_move_constructible_v<sf::OutputSoundFile>); static_assert(std::is_nothrow_move_constructible_v<sf::OutputSoundFile>);
static_assert(!std::is_nothrow_move_assignable_v<sf::OutputSoundFile>); static_assert(std::is_nothrow_move_assignable_v<sf::OutputSoundFile>);