|
Boost Users : |
Subject: Re: [Boost-users] [mem_nf] [bind] static member function binding
From: Stefan Strasser (strasser_at_[hidden])
Date: 2010-06-15 07:12:23
Zitat von Stefan Strasser <strasser_at_[hidden]>:
> does Boost.Bind contain anything to create a function object that is
> statically bound to a member function?
since I haven't found anything, I think this would be a useful
addition to boost.MemFn. (although it might be performance
nitpicking...)
template<class F>
__declspec(noinline) void dispatch(F f){
f();
}
int main(){
A a;
//compiler inlines A::f into dispatch()
dispatch(boost::bind(smem_fun<void (A::*)(),&A::f>(),&a));
//compiler can't inline A::f into dispatch(). indirect function
//call is used.
dispatch(boost::bind(std::mem_fun(&A::f),&a));
}
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net