Boost logo

Boost :

From: Giovanni Piero Deretta (gpderetta_at_[hidden])
Date: 2008-03-13 18:43:51

On Thu, Mar 13, 2008 at 11:18 PM, Robert Dailey <rcdailey_at_[hidden]> wrote:
> Hi,
> Currently I have a class named Foo. Foo is using Boost.Bind to bind one of
> its own private methods to *this. However, since the method I'm binding is
> private, boost.bind cannot call it.

This compiles for me with gcc:

#include <boost/bind.hpp>
class foo {
  void do_bind() {
    int i = boost::bind(&foo::m, _1)(this);
  int m;

in fact the privateness of the member shouldn't matter.
Once you extract the pointer to member, access control doesn't matter
any longer.
Of course you need to extract the pointer to member inside a member
function or a friend of the class,
but bind shouldn't have nothing to do with that.

> Is there a way to make Boost.Bind a
> friend of my class? What is the recommended solution to such a problem? I
> did some quick searching on google about this issue but I came up with no
> results. Thanks.

What is the problem you are encountering exactly?


Boost list run by bdawes at, gregod at, cpdaniel at, john at