From e11154e7f79b7d21ea346f46b6fdac3111bb08e4 Mon Sep 17 00:00:00 2001 From: Chris Thrasher Date: Sun, 10 Dec 2023 00:00:09 -0700 Subject: [PATCH] Define default special member functions in headers --- include/SFML/Audio/SoundRecorder.hpp | 2 +- include/SFML/Audio/SoundStream.hpp | 2 +- include/SFML/Graphics/BlendMode.hpp | 2 +- include/SFML/Graphics/RenderStates.hpp | 2 +- include/SFML/Graphics/RenderWindow.hpp | 2 +- include/SFML/Graphics/Shader.hpp | 2 +- include/SFML/Graphics/Transformable.hpp | 4 ++-- include/SFML/Graphics/VertexArray.hpp | 2 +- include/SFML/Graphics/VertexBuffer.hpp | 2 +- include/SFML/Network/Packet.hpp | 12 ++++++------ include/SFML/System/String.hpp | 2 +- include/SFML/Window/VideoMode.hpp | 2 +- src/SFML/Audio/SoundRecorder.cpp | 4 ---- src/SFML/Audio/SoundStream.cpp | 4 ---- src/SFML/Graphics/BlendMode.cpp | 4 ---- src/SFML/Graphics/RenderStates.cpp | 4 ---- src/SFML/Graphics/RenderWindow.cpp | 4 ---- src/SFML/Graphics/Shader.cpp | 8 -------- src/SFML/Graphics/Transformable.cpp | 8 -------- src/SFML/Graphics/VertexArray.cpp | 4 ---- src/SFML/Graphics/VertexBuffer.cpp | 4 ---- src/SFML/Network/Packet.cpp | 24 ------------------------ src/SFML/System/Android/Activity.cpp | 2 -- src/SFML/System/Android/Activity.hpp | 2 +- src/SFML/System/String.cpp | 4 ---- src/SFML/Window/VideoMode.cpp | 4 ---- src/SFML/Window/macOS/CursorImpl.hpp | 2 +- src/SFML/Window/macOS/CursorImpl.mm | 5 ----- 28 files changed, 20 insertions(+), 103 deletions(-) diff --git a/include/SFML/Audio/SoundRecorder.hpp b/include/SFML/Audio/SoundRecorder.hpp index 9a321a0d0..79f49328f 100644 --- a/include/SFML/Audio/SoundRecorder.hpp +++ b/include/SFML/Audio/SoundRecorder.hpp @@ -193,7 +193,7 @@ protected: /// This constructor is only meant to be called by derived classes. /// //////////////////////////////////////////////////////////// - SoundRecorder(); + SoundRecorder() = default; //////////////////////////////////////////////////////////// /// \brief Set the processing interval diff --git a/include/SFML/Audio/SoundStream.hpp b/include/SFML/Audio/SoundStream.hpp index c6bd19fa3..a36a9b2b4 100644 --- a/include/SFML/Audio/SoundStream.hpp +++ b/include/SFML/Audio/SoundStream.hpp @@ -192,7 +192,7 @@ protected: /// This constructor is only meant to be called by derived classes. /// //////////////////////////////////////////////////////////// - SoundStream(); + SoundStream() = default; //////////////////////////////////////////////////////////// /// \brief Define the audio stream parameters diff --git a/include/SFML/Graphics/BlendMode.hpp b/include/SFML/Graphics/BlendMode.hpp index 2cb8b2bd9..9a164978b 100644 --- a/include/SFML/Graphics/BlendMode.hpp +++ b/include/SFML/Graphics/BlendMode.hpp @@ -80,7 +80,7 @@ struct SFML_GRAPHICS_API BlendMode /// Constructs a blending mode that does alpha blending. /// //////////////////////////////////////////////////////////// - BlendMode(); + BlendMode() = default; //////////////////////////////////////////////////////////// /// \brief Construct the blend mode given the factors and equation. diff --git a/include/SFML/Graphics/RenderStates.hpp b/include/SFML/Graphics/RenderStates.hpp index c209236bf..775512355 100644 --- a/include/SFML/Graphics/RenderStates.hpp +++ b/include/SFML/Graphics/RenderStates.hpp @@ -57,7 +57,7 @@ public: /// \li a null shader /// //////////////////////////////////////////////////////////// - RenderStates(); + RenderStates() = default; //////////////////////////////////////////////////////////// /// \brief Construct a default set of render states with a custom blend mode diff --git a/include/SFML/Graphics/RenderWindow.hpp b/include/SFML/Graphics/RenderWindow.hpp index eaa2036e4..7b878467f 100644 --- a/include/SFML/Graphics/RenderWindow.hpp +++ b/include/SFML/Graphics/RenderWindow.hpp @@ -52,7 +52,7 @@ public: /// use the other constructors or call create() to do so. /// //////////////////////////////////////////////////////////// - RenderWindow(); + RenderWindow() = default; //////////////////////////////////////////////////////////// /// \brief Construct a new window diff --git a/include/SFML/Graphics/Shader.hpp b/include/SFML/Graphics/Shader.hpp index 6d2d88429..f0665da3d 100644 --- a/include/SFML/Graphics/Shader.hpp +++ b/include/SFML/Graphics/Shader.hpp @@ -92,7 +92,7 @@ public: /// This constructor creates an invalid shader. /// //////////////////////////////////////////////////////////// - Shader(); + Shader() = default; //////////////////////////////////////////////////////////// /// \brief Destructor diff --git a/include/SFML/Graphics/Transformable.hpp b/include/SFML/Graphics/Transformable.hpp index 5933746d3..5fc7f4880 100644 --- a/include/SFML/Graphics/Transformable.hpp +++ b/include/SFML/Graphics/Transformable.hpp @@ -47,13 +47,13 @@ public: /// \brief Default constructor /// //////////////////////////////////////////////////////////// - Transformable(); + Transformable() = default; //////////////////////////////////////////////////////////// /// \brief Virtual destructor /// //////////////////////////////////////////////////////////// - virtual ~Transformable(); + virtual ~Transformable() = default; //////////////////////////////////////////////////////////// /// \brief set the position of the object diff --git a/include/SFML/Graphics/VertexArray.hpp b/include/SFML/Graphics/VertexArray.hpp index 8af2b6ed5..f36f72e70 100644 --- a/include/SFML/Graphics/VertexArray.hpp +++ b/include/SFML/Graphics/VertexArray.hpp @@ -52,7 +52,7 @@ public: /// Creates an empty vertex array. /// //////////////////////////////////////////////////////////// - VertexArray(); + VertexArray() = default; //////////////////////////////////////////////////////////// /// \brief Construct the vertex array with a type and an initial number of vertices diff --git a/include/SFML/Graphics/VertexBuffer.hpp b/include/SFML/Graphics/VertexBuffer.hpp index c27e3c902..c76102d5e 100644 --- a/include/SFML/Graphics/VertexBuffer.hpp +++ b/include/SFML/Graphics/VertexBuffer.hpp @@ -72,7 +72,7 @@ public: /// Creates an empty vertex buffer. /// //////////////////////////////////////////////////////////// - VertexBuffer(); + VertexBuffer() = default; //////////////////////////////////////////////////////////// /// \brief Construct a VertexBuffer with a specific PrimitiveType diff --git a/include/SFML/Network/Packet.hpp b/include/SFML/Network/Packet.hpp index a4a5927f5..3998c699f 100644 --- a/include/SFML/Network/Packet.hpp +++ b/include/SFML/Network/Packet.hpp @@ -56,37 +56,37 @@ public: /// Creates an empty packet. /// //////////////////////////////////////////////////////////// - Packet(); + Packet() = default; //////////////////////////////////////////////////////////// /// \brief Virtual destructor /// //////////////////////////////////////////////////////////// - virtual ~Packet(); + virtual ~Packet() = default; //////////////////////////////////////////////////////////// /// \brief Copy constructor /// //////////////////////////////////////////////////////////// - Packet(const Packet&); + Packet(const Packet&) = default; //////////////////////////////////////////////////////////// /// \brief Copy assignment /// //////////////////////////////////////////////////////////// - Packet& operator=(const Packet&); + Packet& operator=(const Packet&) = default; //////////////////////////////////////////////////////////// /// \brief Move constructor /// //////////////////////////////////////////////////////////// - Packet(Packet&&) noexcept; + Packet(Packet&&) noexcept = default; //////////////////////////////////////////////////////////// /// \brief Move assignment /// //////////////////////////////////////////////////////////// - Packet& operator=(Packet&&) noexcept; + Packet& operator=(Packet&&) noexcept = default; //////////////////////////////////////////////////////////// /// \brief Append data to the end of the packet diff --git a/include/SFML/System/String.hpp b/include/SFML/System/String.hpp index c571f5d74..e22cfae21 100644 --- a/include/SFML/System/String.hpp +++ b/include/SFML/System/String.hpp @@ -67,7 +67,7 @@ public: /// This constructor creates an empty string. /// //////////////////////////////////////////////////////////// - String(); + String() = default; //////////////////////////////////////////////////////////// /// \brief Construct from a single ANSI character and a locale diff --git a/include/SFML/Window/VideoMode.hpp b/include/SFML/Window/VideoMode.hpp index 53fb5e6a3..225cb5fc8 100644 --- a/include/SFML/Window/VideoMode.hpp +++ b/include/SFML/Window/VideoMode.hpp @@ -49,7 +49,7 @@ public: /// This constructors initializes all members to 0. /// //////////////////////////////////////////////////////////// - VideoMode(); + VideoMode() = default; //////////////////////////////////////////////////////////// /// \brief Construct the video mode with its attributes diff --git a/src/SFML/Audio/SoundRecorder.cpp b/src/SFML/Audio/SoundRecorder.cpp index ee657350d..712d3edc1 100644 --- a/src/SFML/Audio/SoundRecorder.cpp +++ b/src/SFML/Audio/SoundRecorder.cpp @@ -52,10 +52,6 @@ ALCdevice* captureDevice = nullptr; namespace sf { -//////////////////////////////////////////////////////////// -SoundRecorder::SoundRecorder() = default; - - //////////////////////////////////////////////////////////// SoundRecorder::~SoundRecorder() { diff --git a/src/SFML/Audio/SoundStream.cpp b/src/SFML/Audio/SoundStream.cpp index 1ebf38167..6efc2d4e8 100644 --- a/src/SFML/Audio/SoundStream.cpp +++ b/src/SFML/Audio/SoundStream.cpp @@ -47,10 +47,6 @@ namespace sf { -//////////////////////////////////////////////////////////// -SoundStream::SoundStream() = default; - - //////////////////////////////////////////////////////////// SoundStream::~SoundStream() { diff --git a/src/SFML/Graphics/BlendMode.cpp b/src/SFML/Graphics/BlendMode.cpp index 52395b4c7..97d13f78c 100644 --- a/src/SFML/Graphics/BlendMode.cpp +++ b/src/SFML/Graphics/BlendMode.cpp @@ -46,10 +46,6 @@ const BlendMode BlendMax(BlendMode::One, BlendMode::One, BlendMode::Max); const BlendMode BlendNone(BlendMode::One, BlendMode::Zero, BlendMode::Add); -//////////////////////////////////////////////////////////// -BlendMode::BlendMode() = default; - - //////////////////////////////////////////////////////////// BlendMode::BlendMode(Factor sourceFactor, Factor destinationFactor, Equation blendEquation) : colorSrcFactor(sourceFactor), diff --git a/src/SFML/Graphics/RenderStates.cpp b/src/SFML/Graphics/RenderStates.cpp index 217da17ad..21b566442 100644 --- a/src/SFML/Graphics/RenderStates.cpp +++ b/src/SFML/Graphics/RenderStates.cpp @@ -44,10 +44,6 @@ const RenderStates RenderStates::Default(BlendMode( BlendMode::Add)); -//////////////////////////////////////////////////////////// -RenderStates::RenderStates() = default; - - //////////////////////////////////////////////////////////// RenderStates::RenderStates(const Transform& theTransform) : transform(theTransform) { diff --git a/src/SFML/Graphics/RenderWindow.cpp b/src/SFML/Graphics/RenderWindow.cpp index 344a0a32a..acbdb56c3 100644 --- a/src/SFML/Graphics/RenderWindow.cpp +++ b/src/SFML/Graphics/RenderWindow.cpp @@ -36,10 +36,6 @@ namespace sf { -//////////////////////////////////////////////////////////// -RenderWindow::RenderWindow() = default; - - //////////////////////////////////////////////////////////// RenderWindow::RenderWindow(VideoMode mode, const String& title, std::uint32_t style, const ContextSettings& settings) { diff --git a/src/SFML/Graphics/Shader.cpp b/src/SFML/Graphics/Shader.cpp index f9ee3b277..b7bf47cc9 100644 --- a/src/SFML/Graphics/Shader.cpp +++ b/src/SFML/Graphics/Shader.cpp @@ -226,10 +226,6 @@ struct Shader::UniformBinder }; -//////////////////////////////////////////////////////////// -Shader::Shader() = default; - - //////////////////////////////////////////////////////////// Shader::~Shader() { @@ -966,10 +962,6 @@ namespace sf Shader::CurrentTextureType Shader::CurrentTexture; -//////////////////////////////////////////////////////////// -Shader::Shader() = default; - - //////////////////////////////////////////////////////////// Shader::~Shader() = default; diff --git a/src/SFML/Graphics/Transformable.cpp b/src/SFML/Graphics/Transformable.cpp index 9b1f64414..f9f9149fd 100644 --- a/src/SFML/Graphics/Transformable.cpp +++ b/src/SFML/Graphics/Transformable.cpp @@ -32,14 +32,6 @@ namespace sf { -//////////////////////////////////////////////////////////// -Transformable::Transformable() = default; - - -//////////////////////////////////////////////////////////// -Transformable::~Transformable() = default; - - //////////////////////////////////////////////////////////// void Transformable::setPosition(const Vector2f& position) { diff --git a/src/SFML/Graphics/VertexArray.cpp b/src/SFML/Graphics/VertexArray.cpp index b3aa1e3d4..7df848632 100644 --- a/src/SFML/Graphics/VertexArray.cpp +++ b/src/SFML/Graphics/VertexArray.cpp @@ -33,10 +33,6 @@ namespace sf { -//////////////////////////////////////////////////////////// -VertexArray::VertexArray() = default; - - //////////////////////////////////////////////////////////// VertexArray::VertexArray(PrimitiveType type, std::size_t vertexCount) : m_vertices(vertexCount), m_primitiveType(type) { diff --git a/src/SFML/Graphics/VertexBuffer.cpp b/src/SFML/Graphics/VertexBuffer.cpp index e8ea0908b..5fb4f138b 100644 --- a/src/SFML/Graphics/VertexBuffer.cpp +++ b/src/SFML/Graphics/VertexBuffer.cpp @@ -61,10 +61,6 @@ GLenum usageToGlEnum(sf::VertexBuffer::Usage usage) namespace sf { -//////////////////////////////////////////////////////////// -VertexBuffer::VertexBuffer() = default; - - //////////////////////////////////////////////////////////// VertexBuffer::VertexBuffer(PrimitiveType type) : m_primitiveType(type) { diff --git a/src/SFML/Network/Packet.cpp b/src/SFML/Network/Packet.cpp index 04d1fe288..e355395be 100644 --- a/src/SFML/Network/Packet.cpp +++ b/src/SFML/Network/Packet.cpp @@ -37,30 +37,6 @@ namespace sf { -//////////////////////////////////////////////////////////// -Packet::Packet() = default; - - -//////////////////////////////////////////////////////////// -Packet::~Packet() = default; - - -//////////////////////////////////////////////////////////// -Packet::Packet(const Packet&) = default; - - -//////////////////////////////////////////////////////////// -Packet& Packet::operator=(const Packet&) = default; - - -//////////////////////////////////////////////////////////// -Packet::Packet(Packet&&) noexcept = default; - - -//////////////////////////////////////////////////////////// -Packet& Packet::operator=(Packet&&) noexcept = default; - - //////////////////////////////////////////////////////////// void Packet::append(const void* data, std::size_t sizeInBytes) { diff --git a/src/SFML/System/Android/Activity.cpp b/src/SFML/System/Android/Activity.cpp index d4b7d6d66..363d93cb6 100644 --- a/src/SFML/System/Android/Activity.cpp +++ b/src/SFML/System/Android/Activity.cpp @@ -35,8 +35,6 @@ #define LOGE(...) ((void)__android_log_print(ANDROID_LOG_INFO, "sfml-error", __VA_ARGS__)) -LogcatStream::LogcatStream() = default; - std::streambuf::int_type LogcatStream::overflow(std::streambuf::int_type c) { if (c == '\n') diff --git a/src/SFML/System/Android/Activity.hpp b/src/SFML/System/Android/Activity.hpp index 7d981cb8f..0563f6738 100644 --- a/src/SFML/System/Android/Activity.hpp +++ b/src/SFML/System/Android/Activity.hpp @@ -44,7 +44,7 @@ class SFML_SYSTEM_API LogcatStream : public std::streambuf { public: - LogcatStream(); + LogcatStream() = default; std::streambuf::int_type overflow(std::streambuf::int_type c) override; diff --git a/src/SFML/System/String.cpp b/src/SFML/System/String.cpp index f25635803..394c4d065 100644 --- a/src/SFML/System/String.cpp +++ b/src/SFML/System/String.cpp @@ -37,10 +37,6 @@ namespace sf { -//////////////////////////////////////////////////////////// -String::String() = default; - - //////////////////////////////////////////////////////////// String::String(char ansiChar, const std::locale& locale) { diff --git a/src/SFML/Window/VideoMode.cpp b/src/SFML/Window/VideoMode.cpp index 5f48ac94e..f1a18059c 100644 --- a/src/SFML/Window/VideoMode.cpp +++ b/src/SFML/Window/VideoMode.cpp @@ -34,10 +34,6 @@ namespace sf { -//////////////////////////////////////////////////////////// -VideoMode::VideoMode() = default; - - //////////////////////////////////////////////////////////// VideoMode::VideoMode(const Vector2u& modeSize, unsigned int modeBitsPerPixel) : size(modeSize), diff --git a/src/SFML/Window/macOS/CursorImpl.hpp b/src/SFML/Window/macOS/CursorImpl.hpp index 45012607d..6ac2d2f1d 100644 --- a/src/SFML/Window/macOS/CursorImpl.hpp +++ b/src/SFML/Window/macOS/CursorImpl.hpp @@ -61,7 +61,7 @@ public: /// Refer to sf::Cursor::Cursor(). /// //////////////////////////////////////////////////////////// - CursorImpl(); + CursorImpl() = default; //////////////////////////////////////////////////////////// /// \brief Destructor diff --git a/src/SFML/Window/macOS/CursorImpl.mm b/src/SFML/Window/macOS/CursorImpl.mm index 250bf0eb1..ad3ab0079 100644 --- a/src/SFML/Window/macOS/CursorImpl.mm +++ b/src/SFML/Window/macOS/CursorImpl.mm @@ -49,11 +49,6 @@ NSCursor* loadFromSelector(SEL selector) namespace sf::priv { - -//////////////////////////////////////////////////////////// -CursorImpl::CursorImpl() = default; - - //////////////////////////////////////////////////////////// CursorImpl::~CursorImpl() {