Boost logo

Boost :

From: Slawomir Lisznianski (sl_at_[hidden])
Date: 2007-06-24 23:30:23


I'm trying to use bind() on a class member variable of type
boost::signal but it fails with the message (GCC 4.0.2):

/usr/include/boost/noncopyable.hpp:27: error:
‘boost::noncopyable_::noncopyable::noncopyable(const
boost::noncopyable_::noncopyable&)’ is private
/usr/include/boost/signals/detail/signal_base.hpp:120: error: within
this context

I understand that signals are non-copyable per design, yet I'd like to
be able to bind them somehow ;-)

Is there a better way of doing that other than through a member function
acting as a forwarding agent? For example:

#include <boost/signal.hpp>
#include <boost/bind.hpp>
#include <boost/function.hpp>

using namespace boost;

struct foo
{
   signal0<void> on_event;

   void on_event_fwd()
   {
     on_event();
   }
};

int main(int, char**)
{
   foo fo;

   function0<void> f =
     bind(&foo::on_event, &fo); <-- doesn't compile

   // forward to signal, oh well
   //
   function0<void> f = bind(&foo::on_event_fwd, &fo);

   return 0;
}

Cheers,
Slawomir Lisznianski


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