|
From: Frank M. H. <fm...@us...> - 2007-02-28 15:54:29
|
Update of /cvsroot/boost-sandbox/boost-sandbox/libs/thread_safe_signals/test In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv14350/libs/thread_safe_signals/test Modified Files: track_test.cpp Log Message: Added some templated copy constructors to slot class, to prevent loss of tracking on copy construction. Index: track_test.cpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/libs/thread_safe_signals/test/track_test.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- track_test.cpp 27 Feb 2007 22:24:33 -0000 1.2 +++ track_test.cpp 28 Feb 2007 15:54:22 -0000 1.3 @@ -39,7 +39,7 @@ static int myfunc(int i, double z) { - std::cout << __FUNCTION__ << ": z is " << z << std::endl; + std::cout << __FUNCTION__ << ": i is " << i << " and z is " << z << std::endl; return i; } @@ -59,13 +59,17 @@ // Test auto-disconnection of slot before signal connection { - boost::shared_ptr<int> shorty(new int()); - //works - sig_type::slot_type slot(boost::bind(swallow(), shorty.get(), _1)); - // also works -// sig_type::slot_type slot = sig_type::slot_type(swallow(), shorty.get(), _1); - // doesn't work? gcc says: error: type specifier omitted for parameter `shorty' + boost::shared_ptr<int> shorty(new int(1)); +// doesn't work? gcc says: error: type specifier omitted for parameter `shorty' // sig_type::slot_type slot(swallow(), shorty.get(), _1); +//works +// sig_type::slot_type slot(boost::bind(swallow(), shorty.get(), _1)); +// also works +// sig_type::slot_type slot = sig_type::slot_type(swallow(), shorty.get(), _1); +// also works + swallow myswallow; + sig_type::slot_type slot(myswallow, shorty.get(), _1); + slot.track(shorty); shorty.reset(); s1.connect(slot); |