Re: [sigc] Re: [Boost-users] Signals & Slots



On Sat, 2004-11-20 at 20:43, Chris Vine wrote:
> On Saturday 20 November 2004 20:58, Carl Nygard wrote:
> 
> [snip]

> There are some errors in your examples.
> 

Like I said, I haven't actually compiled any examples;)  Thanks for the
catch... document is updated.

> With the following specimen code you provide:
> 
>   class Foo {
>   public:
>       // ...
>       int Func(float val, string str);
>   };
>   Foo obj;
>   boost::signal<int, float, string> sig;
> 
> To connect the boost signal to a boost function object (the libsigc++ 
> equivalent of a slot) the expression is not:
>   sig.connect(boost::bind(&Foo::Func, obj));
> but is:
>   sig.connect(boost::bind(&Foo::Func, obj, _1, _2)); or
>   sig.connect(boost::bind(&Foo::Func, &obj, _1, _2));
> (both do the same).
> 
> And with a libsigc++ signal:
>   sigc::signal<int, float, string> sig;
> the expression is not:
>   sig.connect(sigc::mem_fun(&Foo::Func, obj));
> but is:
>   sig.connect(sigc::mem_fun(obj, &Foo::Func));
> 
> This is as I had used it with boost 1.30, but I don't think this has changed 
> with boost 1.32, which has just come out (boost tries to keep its API 
> reasonably stable between releases).  See the examples I posted for further 
> details.
> 
> Chris.
> _______________________________________________
> gtkmm-list mailing list
> gtkmm-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtkmm-list




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