$include_dir="/home/hyper-archives/boost-users/include"; include("$include_dir/msg-header.inc") ?>
From: Rodolfo Lima (rodolfo_at_[hidden])
Date: 2006-11-28 20:25:32
> No idea. :-)
Me neither, it's rather complicated to follow lambda inner workings.
>
> I see... then a get_pointer overload won't work either, since you can't
> return a raw pointer from it, and shared_ptr doesn't define operator->*. 
> If
> you can't cache the shared_ptr locally in aux, the only remaining option 
> is
> two nested binds.
I'm almost giving up. To sum up what we've got so far, I've written this 
code
// To mimic c++0x auto type (with help of g++'s typeof)
#define auto(var, def) typeof(def) var = def
struct aux
{
    aux() : b(1) {}
    int a() const { return 5; }
    int b;
};
int main()
{
    aux a;
    // This compiles and executes as expected, we're dealing with a pointer 
to an attribute.
    boost::function<int(const aux &)> fa = &_1->*&aux::b;
    int ia = fa(a);
    cout << ia << endl;
    // This works, but it's not the way we want, we're dealing with a 
pointer to a member function.
    auto(fm1, &_1->*&aux::a);
    int im1 = fm1(a)();
    cout << im1 << endl;
    // This 'should' work, but doesn't compile.
    auto(fm2, &protect(_1)->*&aux::a);
    int im2 = fm2()(a);
    cout << im2 << endl;
    return 0;
}
I think that protect could be used to swap the order of functor 
instantiations, but it doesn't work.
I hope Jaakko Järvi drops by and gives some advice.
Thank you very much for your help,
    Rodolfo Lima.