diff options
author | David Robillard <d@drobilla.net> | 2020-10-14 21:02:41 +0200 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2020-10-14 21:02:41 +0200 |
commit | 96f6df5b89a300ef69dcba929a2810cb3e5e26ef (patch) | |
tree | 1823b6927aafeb28d12ec1052ca61fab0abb76bc | |
parent | 24949b8218a149b8030a85129c6c82c5427ef640 (diff) |
Explicitly declare all special methods
-rw-r--r-- | examples/pugl_cxx_demo.cpp | 8 | ||||
-rw-r--r-- | pugl/pugl.hpp | 18 | ||||
-rw-r--r-- | 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<class T, FreeFunc<T> 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<PuglWorld, puglFreeWorld> { 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<PuglWorldType>(type), flags)} , _clock(*this) @@ -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 ], }) |