Boost logo

Boost :

Subject: Re: [boost] [local] Any "active Boost library author" in favor of Boost.Local?
From: Vicente J. Botet Escriba (vicente.botet_at_[hidden])
Date: 2011-11-25 12:32:18


Le 25/11/11 18:18, Lorenzo Caminiti a écrit :
> On Fri, Nov 25, 2011 at 11:06 AM, Vicente Botet
> <vicente.botet_at_[hidden]> 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


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk