added some comments to explain the code

This commit is contained in:
Kjistóf 2016-11-27 14:34:23 +01:00
parent a037369c39
commit 4756e53292

View File

@ -3,15 +3,15 @@
template <typename Fun>
template <typename Fun> // here Fun will be a function signature
class Function;
template <typename Ret, typename... Args>
template <typename Ret, typename... Args> // specialization, so we can work
class Function<Ret(Args...)>
{
private:
class callable_base
class callable_base // type-erasure magic for functors
{
public:
virtual Ret call(Args...) const = 0;
@ -52,7 +52,7 @@ public:
return *this;
}
Function& operator=(std::nullptr_t)
Function& operator=(std::nullptr_t) // exploiting that decltype(nullptr) is std::nullptr_t
{ _is_null = true; }
Ret operator()(Args... args) const