Re: [sigc] default constructor needed for R in sigc::slot<R, A1, ...>



On Wed, 2005-12-21 at 20:40 +0100, Matthias Langer wrote:
> At least for libsigc++-2.0.15 the return type R in sigc::slot<R, ...>
> needs to be default constructible.

This is probably so that a signal can return a value even when no slots
are connected. But your example uses a slot and no signals, so that
seems unnecessary. But I guess the same code must compile whether or not
the slot is

sigc::slot<NoDefCtor> tSlot(ptr_func(func));
or
sigc::slot<NoDefCtor> tSlot;

And then tSlot() must return something.


>  To verify this try
> 
> #include <sigc++/slot.h>
> using sigc::slot; using sigc::ptr_fun;
> 
> class NoDefCtor
> {
> 	public:
> 	NoDefCtor(int dummy) {}
> };
> 
> NoDefCtor func() 
> { return NoDefCtor(3); }
> 
> int main()
> {
> 	sigc::slot<NoDefCtor> tSlot(ptr_fun(func));
> 	tSlot();
> }
> 
> Now, i don't want to say that this is a bug, but i think it would be
> nicer if the above code fragment compiles ...
> 
> Any comments ?
> Matthias
> 
> 
> _______________________________________________
> libsigc-list mailing list
> libsigc-list gnome org
> http://mail.gnome.org/mailman/listinfo/libsigc-list
-- 
Murray Cumming
murrayc murrayc com
www.murrayc.com
www.openismus.com




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