How to overload the ->* operator?
<p>I tried this, and some variations on it:</p>

<pre><code>template&lt;class T&gt;
class Ptr {
public:
    Ptr(T* ptr) : p(ptr) {}
    ~Ptr() { if(p) delete p; }

    template&lt;class Method&gt;
    Method operator -&gt;* (Method method)
    {
        return p-&gt;*method;
    }

private:
    T *p;
};

class Foo {
public:
    void foo(int) {}
    int bar() { return 3; }
};

int main() {
    Ptr&lt;Foo&gt; p(new Foo());

    void (Foo::*method)(int) = &amp;Foo::foo;
    int (Foo::*method2)() = &amp;Foo::bar;

    (p-&gt;*method)(5);
    (p-&gt;*method2)();

    return 0;
}
</code></pre>

<p>But it <a href="http://ideone.com/oUJLG">doesn't work</a>. The problem is that I don't really know what to expect as a parameter or what to return. The standard on this is incomprehensible to me, and since Google did not bring up anything helpful I guess I'm not alone.</p>

<p><em>Edit:</em> Another try, with C++0x: <a href="http://ideone.com/lMlyB">http://ideone.com/lMlyB</a></p>
