std::function implementation I've decided to make an implementation of the C++11 class function. I was checking that I have done everything correctly and have not missed anything:

template &lt; typename &gt; class function;

template &lt; typename _Ret, typename... _Args &gt; class function&lt;_Ret(_Args...)&gt;
{
public:
    typedef _Ret result_type;
    typedef function&lt;result_type(_Args...)&gt; _Myt;
    typedef result_type(*pointer)(_Args...);

    function()
        : _f_ptr(nullptr)
    {
    }

    template &lt; typename _Fn_Ty &gt; function(_Fn_Ty &amp;&amp;_Fn)
        : _f_ptr(reinterpret_cast&lt;pointer&gt;(_Fn))
    {
    }

    function(pointer &amp;&amp;_Fn)
        : _f_ptr(_Fn)
    {
    }

    function(const _Myt &amp;_Rhs)
        : _f_ptr(_Rhs.f_ptr)
    {
    }

    function(_Myt &amp;&amp;_Rhs)
        : _f_ptr(_Rhs.f_ptr)
    {
    }

    ~function()
    {
    }

    _Myt &amp;assign(pointer &amp;&amp;_Fn)
    {
        _f_ptr = _Fn;
        return *this;
    }

    _Myt &amp;operator=(pointer &amp;&amp;_Fn)
    {
        return assign(_Fn);
    }

    template &lt; typename _Fn_Ty &gt; _Myt &amp;assign(_Fn_Ty &amp;&amp;_Fn)
    {
        _f_ptr = reinterpret_cast&lt;pointer&gt;(_Fn);
        return *this;
    }

    template &lt; typename _Fn_Ty &gt; _Myt &amp;operator=(_Fn_Ty &amp;&amp;_Fn)
    {
        return assign&lt;_Fn_Ty&gt;(_Fn);
    }

    result_type operator()(_Args... _Arguments)
    {
        if (_f_ptr == nullptr)
        {
            throw std::exception("nullptr found instead of function");
        }
        return _f_ptr(_Arguments...);
    }

    pointer &amp;ptr() const
    {
        return _f_ptr;
    }

    operator pointer &amp;() const
{
    return _f_ptr;
}
private:
    pointer _f_ptr;
};
Your code has no chance of working, because the only non-static data member of your function&lt;void(void)&gt; is a single pointer of type void (*)(void). There's no room to store any other kind of functor.

In other words, you've implemented the concept of "function pointer wrapped in a struct", but you haven't implemented anything like std::function yet.