|
Boost : |
Subject: Re: [boost] Determining interest in Delegates submission
From: Jeffrey Lee Hellrung, Jr. (jeffrey.hellrung_at_[hidden])
Date: 2011-09-08 10:19:39
On Wed, Sep 7, 2011 at 7:48 PM, Jared McKee <jared.mckee_at_[hidden]> wrote:
> I would like to determine interest in a possible library submission.
>
> I have written some code which converts a member function and object
> pointer
> combination to a free function for use in C style callbacks. It has some
> limitations which I will describe shortly.
>
> The basic idea is to be able to convert:
>
> R (B::*)(T0,T1,
) and B*
>
> to
>
> R (*)(T0,T1,
)
>
> Here's an example usage:
>
> class foo {
> int x;
> int test(int v) {return x + v;}
> };
>
> foo* a = new foo;
> a->x = 3;
> int (*f)(int) = delegate(a, &foo::inc);
> cout << f(4) << endl; // outputs "7"
>
[...snip implementation notes...]
I admit I only glossed over your implementation notes, but it looks like
this would be very similar to (or...the same as...?) a bound (e.g., via
Boost.Bind) boost::mem_fn:
http://www.boost.org/doc/libs/1_47_0/libs/bind/mem_fn.html
Is that accurate?
By the way, this is my first active participation in any open source project
> :)
>
> Jared
>
Welcome!
- Jeff
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk