diff --git a/include/SFML/Window/Window.hpp b/include/SFML/Window/Window.hpp index be9d884f3..2310c1125 100644 --- a/include/SFML/Window/Window.hpp +++ b/include/SFML/Window/Window.hpp @@ -134,6 +134,30 @@ public: //////////////////////////////////////////////////////////// ~Window() override; + //////////////////////////////////////////////////////////// + /// \brief Deleted copy constructor + /// + //////////////////////////////////////////////////////////// + Window(const Window&) = delete; + + //////////////////////////////////////////////////////////// + /// \brief Deleted copy assignment + /// + //////////////////////////////////////////////////////////// + Window& operator=(const Window&) = delete; + + //////////////////////////////////////////////////////////// + /// \brief Move constructor + /// + //////////////////////////////////////////////////////////// + Window(Window&&) noexcept; + + //////////////////////////////////////////////////////////// + /// \brief Move assignment + /// + //////////////////////////////////////////////////////////// + Window& operator=(Window&&) noexcept; + //////////////////////////////////////////////////////////// /// \brief Create (or recreate) the window /// diff --git a/include/SFML/Window/WindowBase.hpp b/include/SFML/Window/WindowBase.hpp index a015b1374..5ebbba8f3 100644 --- a/include/SFML/Window/WindowBase.hpp +++ b/include/SFML/Window/WindowBase.hpp @@ -130,6 +130,18 @@ public: //////////////////////////////////////////////////////////// WindowBase& operator=(const WindowBase&) = delete; + //////////////////////////////////////////////////////////// + /// \brief Move constructor + /// + //////////////////////////////////////////////////////////// + WindowBase(WindowBase&&) noexcept; + + //////////////////////////////////////////////////////////// + /// \brief Move assignment + /// + //////////////////////////////////////////////////////////// + WindowBase& operator=(WindowBase&&) noexcept; + //////////////////////////////////////////////////////////// /// \brief Create (or recreate) the window /// diff --git a/src/SFML/Window/Window.cpp b/src/SFML/Window/Window.cpp index b8ee1ded1..ad18d1a77 100644 --- a/src/SFML/Window/Window.cpp +++ b/src/SFML/Window/Window.cpp @@ -66,6 +66,14 @@ Window::Window(WindowHandle handle, const ContextSettings& settings) Window::~Window() = default; +//////////////////////////////////////////////////////////// +Window::Window(Window&&) noexcept = default; + + +//////////////////////////////////////////////////////////// +Window& Window::operator=(Window&&) noexcept = default; + + //////////////////////////////////////////////////////////// void Window::create(VideoMode mode, const String& title, std::uint32_t style, State state) { diff --git a/src/SFML/Window/WindowBase.cpp b/src/SFML/Window/WindowBase.cpp index e3872d183..313fd87e2 100644 --- a/src/SFML/Window/WindowBase.cpp +++ b/src/SFML/Window/WindowBase.cpp @@ -77,6 +77,14 @@ WindowBase::WindowBase(WindowHandle handle) WindowBase::~WindowBase() = default; +//////////////////////////////////////////////////////////// +WindowBase::WindowBase(WindowBase&&) noexcept = default; + + +//////////////////////////////////////////////////////////// +WindowBase& WindowBase::operator=(WindowBase&&) noexcept = default; + + //////////////////////////////////////////////////////////// void WindowBase::create(VideoMode mode, const String& title, std::uint32_t style, State state) { diff --git a/test/Graphics/RenderWindow.test.cpp b/test/Graphics/RenderWindow.test.cpp index aa6ab5c79..d1cde4b71 100644 --- a/test/Graphics/RenderWindow.test.cpp +++ b/test/Graphics/RenderWindow.test.cpp @@ -21,8 +21,8 @@ TEST_CASE("[Graphics] sf::RenderWindow", runDisplayTests()) STATIC_CHECK(std::has_virtual_destructor_v); STATIC_CHECK(!std::is_copy_constructible_v); STATIC_CHECK(!std::is_copy_assignable_v); - STATIC_CHECK(!std::is_nothrow_move_constructible_v); - STATIC_CHECK(!std::is_nothrow_move_assignable_v); + STATIC_CHECK(std::is_nothrow_move_constructible_v); + STATIC_CHECK(std::is_nothrow_move_assignable_v); } SECTION("Construction") diff --git a/test/Window/Window.test.cpp b/test/Window/Window.test.cpp index a2ce96bb1..1cf8f753d 100644 --- a/test/Window/Window.test.cpp +++ b/test/Window/Window.test.cpp @@ -14,10 +14,11 @@ TEST_CASE("[Window] sf::Window", runDisplayTests()) { SECTION("Type traits") { + STATIC_CHECK(std::has_virtual_destructor_v); STATIC_CHECK(!std::is_copy_constructible_v); STATIC_CHECK(!std::is_copy_assignable_v); - STATIC_CHECK(!std::is_nothrow_move_constructible_v); - STATIC_CHECK(!std::is_nothrow_move_assignable_v); + STATIC_CHECK(std::is_nothrow_move_constructible_v); + STATIC_CHECK(std::is_nothrow_move_assignable_v); } SECTION("Construction") diff --git a/test/Window/WindowBase.test.cpp b/test/Window/WindowBase.test.cpp index 98f46db84..76b862b7f 100644 --- a/test/Window/WindowBase.test.cpp +++ b/test/Window/WindowBase.test.cpp @@ -16,10 +16,11 @@ TEST_CASE("[Window] sf::WindowBase", runDisplayTests()) { SECTION("Type traits") { + STATIC_CHECK(std::has_virtual_destructor_v); STATIC_CHECK(!std::is_copy_constructible_v); STATIC_CHECK(!std::is_copy_assignable_v); - STATIC_CHECK(!std::is_nothrow_move_constructible_v); - STATIC_CHECK(!std::is_nothrow_move_assignable_v); + STATIC_CHECK(std::is_nothrow_move_constructible_v); + STATIC_CHECK(std::is_nothrow_move_assignable_v); } SECTION("Construction")