
Le 25/11/11 18:18, Lorenzo Caminiti a écrit :
On Fri, Nov 25, 2011 at 11:06 AM, Vicente Botet <vicente.botet@wanadoo.fr> wrote:
* access to the non public functions of the embedding class (in case of a local function of a member function). Can you explain this point better? This example shows that you can access public, protected, and private members of a bound object (from within a member of the same class):
#include<boost/local/function.hpp> #include<iostream>
struct x { void f() { void BOOST_LOCAL_FUNCTION_PARAMS(bind this) { this_->priv(); this_->prot(); this_->publ(); } BOOST_LOCAL_FUNCTION_NAME(l) l(); }
public: void publ() { std::cout<< "public"<< std::endl; } protected: void prot() { std::cout<< "protected"<< std::endl; } private: void priv() { std::cout<< "private"<< std::endl; } };
int main ( ) { x xx; xx.f(); return 0; } Sorry, I miss Boost.Local was able to do that. Where in the documentation can I find the local function can access the non-public interface?
Best, Vicente