From 96f6df5b89a300ef69dcba929a2810cb3e5e26ef Mon Sep 17 00:00:00 2001 From: David Robillard Date: Wed, 14 Oct 2020 21:02:41 +0200 Subject: Explicitly declare all special methods --- examples/pugl_cxx_demo.cpp | 8 ++++++++ pugl/pugl.hpp | 18 ++++++++++++++++++ wscript | 4 ---- 3 files changed, 26 insertions(+), 4 deletions(-) diff --git a/examples/pugl_cxx_demo.cpp b/examples/pugl_cxx_demo.cpp index 4addee2..439922c 100644 --- a/examples/pugl_cxx_demo.cpp +++ b/examples/pugl_cxx_demo.cpp @@ -38,6 +38,14 @@ public: : pugl::View{world} {} + CubeView(const CubeView&) = delete; + CubeView& operator=(const CubeView&) = delete; + + CubeView(CubeView&&) = delete; + CubeView& operator=(CubeView&&) = delete; + + ~CubeView() override = default; + pugl::Status onConfigure(const pugl::ConfigureEvent& event) override; pugl::Status onUpdate(const pugl::UpdateEvent& event) override; pugl::Status onExpose(const pugl::ExposeEvent& event) override; diff --git a/pugl/pugl.hpp b/pugl/pugl.hpp index f6172d1..8686fa0 100644 --- a/pugl/pugl.hpp +++ b/pugl/pugl.hpp @@ -61,6 +61,12 @@ template Free> class Wrapper { public: + Wrapper(const Wrapper&) = delete; + Wrapper& operator=(const Wrapper&) = delete; + + Wrapper(Wrapper&&) = default; + Wrapper& operator=(Wrapper&&) = default; + T* cobj() { return _ptr.get(); } const T* cobj() const { return _ptr.get(); } @@ -263,6 +269,12 @@ public: : _world{world} {} + Clock(const Clock&) = delete; + Clock& operator=(const Clock&) = delete; + + Clock(Clock&&) = delete; + Clock& operator=(Clock&&) = delete; + /// Return the current time time_point now() const; @@ -274,6 +286,12 @@ private: class World : public detail::Wrapper { public: + World(const World&) = delete; + World& operator=(const World&) = delete; + + World(World&&) = delete; + World& operator=(World&&) = delete; + explicit World(WorldType type, WorldFlags flags) : Wrapper{puglNewWorld(static_cast(type), flags)} , _clock(*this) diff --git a/wscript b/wscript index 9b1e616..ff6a768 100644 --- a/wscript +++ b/wscript @@ -119,10 +119,6 @@ def configure(conf): 'msvc': [ '/wd4355', # 'this' used in base member initializer list '/wd4571', # structured exceptions (SEH) are no longer caught - '/wd4625', # copy constructor implicitly deleted - '/wd4626', # assignment operator implicitly deleted - '/wd5026', # move constructor implicitly deleted - '/wd5027', # move assignment operator implicitly deleted ], }) -- cgit v1.2.1