added implementation for operator=

This commit is contained in:
Kjistóf 2016-11-27 14:06:57 +01:00
parent fe574be197
commit f0e8e4f6ea

View File

@ -16,11 +16,23 @@ private:
class callable : public callable_base
{
private:
Fun _f;
Fun _fun;
public:
callable(Fun f):_f(f) {}
callable(Fun fun):_fun(fun) {}
virtual Ret call(Args... args)
{ return _f(std::forward<Args>(args)...); }
{ return _fun(std::forward<Args>(args)...); }
};
callable_base* _fun;
public:
Function() {}
template <typename Fun>
Function& operator=(Fun fun)
{
_fun = new callable<Fun>(fun);
return *this;
}
~Function() { delete _fun; }
};