diff options
author | David Robillard <d@drobilla.net> | 2020-12-16 17:04:24 +0100 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2020-12-16 17:04:24 +0100 |
commit | 76181729bcd74b1409f07cdbc3b4e2f70af49a54 (patch) | |
tree | 3c8554f9e123f916edb6916bee9742b49491cb1c | |
parent | 3cd021a5059abf291adb2250dfe668b50de7847c (diff) | |
download | lilv-76181729bcd74b1409f07cdbc3b4e2f70af49a54.tar.gz lilv-76181729bcd74b1409f07cdbc3b4e2f70af49a54.tar.bz2 lilv-76181729bcd74b1409f07cdbc3b4e2f70af49a54.zip |
C++: Clean up special member functions
-rw-r--r-- | lilv/lilvmm.hpp | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/lilv/lilvmm.hpp b/lilv/lilvmm.hpp index 0b7ee4d..a5de6c6 100644 --- a/lilv/lilvmm.hpp +++ b/lilv/lilvmm.hpp @@ -93,7 +93,28 @@ uri_to_path(const char* uri) { struct Node { inline Node(const LilvNode* node) : me(lilv_node_duplicate(node)) {} - inline Node(const Node& copy) : me(lilv_node_duplicate(copy.me)) {} + + inline Node(const Node& copy) : me(lilv_node_duplicate(copy.me)) {} + + inline Node& operator=(const Node& rhs) + { + if (&rhs != this) { + lilv_node_free(me); + me = lilv_node_duplicate(rhs.me); + } + return *this; + } + + inline Node(Node&& other) noexcept : me(other.me) { other.me = nullptr; } + + inline Node& operator=(Node&& rhs) noexcept + { + if (&rhs != this) { + me = rhs.me; + rhs.me = nullptr; + } + return *this; + } inline ~Node() { lilv_node_free(me); } @@ -334,6 +355,12 @@ struct World { inline World() : me(lilv_world_new()) {} inline ~World() { lilv_world_free(me); } + World(const World&) = delete; + World& operator=(const World&) = delete; + + World(World&&) = delete; + World& operator=(World&&) = delete; + inline LilvNode* new_uri(const char* uri) { return lilv_new_uri(me, uri); } |