Re: New(Permanent)Callback doesn't support const methods

55 views
Skip to first unread message

Ralph

unread,
Dec 4, 2012, 9:43:29 AM12/4/12
to prot...@googlegroups.com
Dear reader,

Hereby I supply a patch for protobuf-2.4.1 which implements the ability to use const method callbacks.

Kind regards,

Ralph Langendam



Op donderdag 13 september 2012 14:37:03 UTC+2 schreef Ralph het volgende:
Dear reader,

It has come to my attention that the callback mechanism of protobuf 2.4.1 doesn't support the usage of const class methods, as the following example demonstrates:

class C {
public:
    Closure* GetClosure () const {
        return NewCallback<C> (this, &C::RunCallback);
    }
 
    void RunCallback () const {
    }
};

I propose the solution in the attachment for all method callbacks. I've only made an implementation for MethodClosure0, but the others are pretty similar.

Kind regards,

Ralph Langendam


protobuf-2.4.1.diff
Reply all
Reply to author
Forward
0 new messages