[sigc] sigc::bind<> argument copy error



Hi,

The exact problem I'm having with sigc::bind<#> is this. It seems that sigc::bind<#> is trying to copy an argument which is a reference to a non-copyable object (G::IOChannel). The argument is not the argument being bound but one of the other expected arguments. When I comment out the private constructor for the object it compiles OK. Unfortunately, like Gtkmm, the object is part of a class hierarchy of non-copyable objects and the copy constructor must remain private. Here's the code:

bool
adder_response(G::IOChannel& channel, G::IOConditionField condition, TestData *test_data)
{
}

TestData *test_data = new TestData;
G::IOSource io_source(channel, condition, sigc::bind<0>(sigc::ptr_fun(&adder_response), test_data));

which produces this error message:

/home/include/inti-2.0/inti/glib/iochannel.h: In static member function `static
  T_return sigc::internal::slot_call2<T_functor, T_return, T_arg1,
  T_arg2>::call_it(sigc::internal::slot_rep*, typename
  sigc::type_trait<T_arg1>::take, typename sigc::type_trait<T_arg2>::take)
  [with T_functor = sigc::bind_functor<0, TestData*,
sigc::pointer_functor3<Inti::G::IOChannel&, unsigned int, TestData*, bool> >, T_return = bool, T_arg1 = Inti::G::IOChannel&, T_arg2 = IOConditionField]
  ':
/home/include/sigc++-2.0/sigc++/functors/slot.h:466: instantiated from `static void*(* sigc::internal::slot_call2<T_functor, T_return, T_arg1, T_arg2>::address())(void*) [with T_functor = sigc::bind_functor<0, TestData*, sigc::pointer_functor3<Inti::G::IOChannel&, unsigned int, TestData*, bool> >, T_return = bool, T_arg1 = Inti::G::IOChannel&, T_arg2 = IOConditionField]' /home/include/sigc++-2.0/sigc++/functors/slot.h:934: instantiated from `sigc::slot<T_return, T_arg1, T_arg2, sigc::nil, sigc::nil, sigc::nil, sigc::nil, sigc::nil>::slot(const T_functor&) [with T_functor = sigc::bind_functor<0, TestData*, sigc::pointer_functor3<Inti::G::IOChannel&, unsigned int, TestData*, bool> >, T_return = bool, T_arg1 = Inti::G::IOChannel&, T_arg2 = IOConditionField]'
mainloop.cc:307:   instantiated from here
/home/include/inti-2.0/inti/glib/iochannel.h:161: error: `
  Inti::G::IOChannel::IOChannel(const Inti::G::IOChannel&)' is private
/home/include/sigc++-2.0/sigc++/functors/slot.h:459: error: within this context
/home/include/sigc++-2.0/sigc++/functors/slot.h:459: error:   initializing
  argument 1 of `typename sigc::bind_functor<0, T_bound,
  T_functor>::deduce_result_type<T_arg1, T_arg2, void, void, void, void,
  void>::type sigc::bind_functor<0, T_bound, T_functor>::operator()(T_arg1,
T_arg2) [with T_arg1 = Inti::G::IOChannel, T_arg2 = unsigned int, T_bound = TestData*, T_functor = sigc::pointer_functor3<Inti::G::IOChannel&, unsigned
  int, TestData*, bool>]'
make: *** [mainloop] Error 1

Am I using sigc::bind<#> correctly?

Thanks,
Jeff Franks.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]