summaryrefslogtreecommitdiff
path: root/src/callable.h
diff options
context:
space:
mode:
authorEmiel Bruijntjes <emiel.bruijntjes@copernica.com>2014-03-02 19:48:50 +0100
committerEmiel Bruijntjes <emiel.bruijntjes@copernica.com>2014-03-02 19:48:50 +0100
commit3c0d819176620f118b04931e8444e03f62577faf (patch)
treefe1458232d8e33bcd8a09c22ce609a34f83ed252 /src/callable.h
parent51f4788b2b51a21894ae49821abc67c2fab4a68a (diff)
added copy and move constructors to some classes
Diffstat (limited to 'src/callable.h')
-rw-r--r--src/callable.h28
1 files changed, 27 insertions, 1 deletions
diff --git a/src/callable.h b/src/callable.h
index 5b32558..9b5cdcd 100644
--- a/src/callable.h
+++ b/src/callable.h
@@ -49,13 +49,39 @@ public:
// @todo find out number of required arguments
_required = _argc;
}
+
+ /**
+ * Copy constructor
+ * @param that
+ */
+ Callable(const Callable &that) :
+ _ptr(that._ptr),
+ _return(that._return),
+ _required(that._required),
+ _argc(that._argc),
+ _argv(nullptr) {}
+
+ /**
+ * Move constructor
+ * @param that
+ */
+ Callable(Callable &&that) :
+ _ptr(std::move(that._ptr)),
+ _return(that._return),
+ _required(that._required),
+ _argc(that._argc),
+ _argv(that._argv)
+ {
+ // invalidate other object
+ that._argv = nullptr;
+ }
/**
* Destructor
*/
virtual ~Callable()
{
- delete[] _argv;
+ if (_argv) delete[] _argv;
}
/**