added missing virtual dtor for callable_base. first working version

This commit is contained in:
Kjistóf 2016-11-27 14:12:06 +01:00
parent f85b3ec31f
commit 1ae511542c

View File

@ -10,6 +10,8 @@ private:
{
public:
virtual Ret call(Args...) = 0;
virtual ~callable_base() {}
//virtual ~callable_base() = default; // melyik számít szebbnek? van bármi különbség?
};
template <typename Fun>
@ -19,8 +21,11 @@ private:
Fun _fun;
public:
callable(Fun fun):_fun(fun) {}
virtual Ret call(Args... args)
virtual Ret call(Args... args) override
{ return _fun(std::forward<Args>(args)...); }
virtual ~callable() override {}
};
callable_base* _fun;
@ -37,5 +42,8 @@ public:
Ret operator()(Args... args) const
{ return _fun->call(std::forward<Args>(args)...); }
operator bool() const
{ return static_cast<bool>(_fun); }
~Function() { delete _fun; }
};