diff options
author | Murray Cumming <murrayc@murrayc.com> | 2015-08-23 18:52:39 +0200 |
---|---|---|
committer | Murray Cumming <murrayc@murrayc.com> | 2015-08-23 20:02:27 +0200 |
commit | a4248547a50f2743bbef7cea03a93accfe14af9b (patch) | |
tree | 4487fa50216b9fd52b5993160162b2b9cfbe5ac2 /glib/src/module.ccg | |
parent | 8fcab6221c17c90ef101215397309cf2c9d5b2f8 (diff) | |
download | glibmm-a4248547a50f2743bbef7cea03a93accfe14af9b.tar.gz |
C++11: _CLASS_GENERIC classes: Add move operations.
These don't have much in common with each other.
Like most of our move operations, they are completely untested,
though they could be.
Diffstat (limited to 'glib/src/module.ccg')
-rw-r--r-- | glib/src/module.ccg | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/glib/src/module.ccg b/glib/src/module.ccg index 4e4666cd..bcce3e48 100644 --- a/glib/src/module.ccg +++ b/glib/src/module.ccg @@ -26,6 +26,23 @@ Module::Module(const std::string& file_name, ModuleFlags flags) gobject_ (g_module_open(file_name.c_str(), (GModuleFlags) flags)) {} +Module::Module(Module&& other) noexcept +: gobject_(std::move(other.gobject_)) +{ + other.gobject_ = nullptr; +} + +Module& Module::operator=(Module&& other) noexcept +{ + if(gobject_) + g_module_close(gobject_); + + gobject_ = std::move(other.gobject_); + other.gobject_ = nullptr; + + return *this; +} + Module::~Module() { if(gobject_) |