IIRC sigc::signal now has a make_slot() method that returns a sigc::slot. When that returned slot is invoked, it emits the signal. — hpreg
> Le 7 sept. 2015 à 7:48 PM, Martin Bickel <mar...@asc-hq.org> a écrit : > > Hi all, > > I'm currently converting an application from sigc++ 1.2 to sigc++ 2 (tested > 2.4.1 and 2.2.10). > > In 1.2, I could take a signal as a slot and connect it to another signal: > > SigC::Signal0<bool> signal_detected; > SigC::Signal0<bool> alarm; > signal_detected.connect( alarm ); > > > In 2.x , it works for Signals with return type void: > > sigc::signal<void> signal_detected; > sigc::signal<void> warning; > signal_detected.connect( warning ) ; > > > but changing the return value to bool gives a compiler error: > > > #include <sigc++/sigc++.h> > #include <iostream> > > bool warn_people() > { > std::cout << "There are aliens in the carpark!\n"; > return true; > } > > int main() > { > sigc::signal<bool> signal_detected; > sigc::signal<bool> warning; > > warning.connect( sigc::ptr_fun(warn_people) ); > signal_detected.connect( warning ) ; > > signal_detected(); > return 0; > } > > > /home/martin/software/libsigc++-2.4.1/sigc++/functors/slot.h:103:36: error: > void value not ignored as it ought to be > return (typed_rep->functor_)(); > > > Is there any way to use signals as slots without writing an adaptor function > that emits the second signal? > > Regards > Martin > > _______________________________________________ > libsigc-list mailing list > libsigc-list@gnome.org > https://urldefense.proofpoint.com/v2/url?u=https-3A__mail.gnome.org_mailman_listinfo_libsigc-2Dlist&d=BQICAg&c=Sqcl0Ez6M0X8aeM67LKIiDJAXVeAw-YihVMNtXt-uEs&r=dFLFi6i_LtRldFQy7tJ1rg&m=Ekv4npOxhPNiomRef3n3K59iEwrE4ygMYRlqwEyQL60&s=HdZ5a_ieGnYbjhlujhD6uzB09V88g5I5Oy_lww7wq0c&e= > _______________________________________________ libsigc-list mailing list libsigc-list@gnome.org https://mail.gnome.org/mailman/listinfo/libsigc-list