|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r49117 - sandbox/thread_safe_signals/trunk/libs/signals2/test
From: fmhess_at_[hidden]
Date: 2008-10-02 14:20:05
Author: fmhess
Date: 2008-10-02 14:20:05 EDT (Thu, 02 Oct 2008)
New Revision: 49117
URL: http://svn.boost.org/trac/boost/changeset/49117
Log:
Test auto tracking of signal wrapped in a reference_wrapper.
Text files modified:
sandbox/thread_safe_signals/trunk/libs/signals2/test/signal_n_test.cpp | 14 ++++++++++++++
1 files changed, 14 insertions(+), 0 deletions(-)
Modified: sandbox/thread_safe_signals/trunk/libs/signals2/test/signal_n_test.cpp
==============================================================================
--- sandbox/thread_safe_signals/trunk/libs/signals2/test/signal_n_test.cpp (original)
+++ sandbox/thread_safe_signals/trunk/libs/signals2/test/signal_n_test.cpp 2008-10-02 14:20:05 EDT (Thu, 02 Oct 2008)
@@ -8,6 +8,7 @@
// For more information, see http://www.boost.org
#include <boost/optional.hpp>
+#include <boost/ref.hpp>
#include <boost/test/minimal.hpp>
#include <boost/signals2.hpp>
#include <functional>
@@ -158,6 +159,19 @@
} // s2 goes out of scope and disconnects
BOOST_CHECK(s1(3) == -3);
+
+ // test auto-track of signal wrapped in a reference_wrapper
+ {
+ signal_type s2;
+ s1.connect(boost::cref(s2));
+ s2.connect(std::bind1st(std::multiplies<int>(), 2));
+ s2.connect(std::bind1st(std::multiplies<int>(), -3));
+
+ BOOST_CHECK(s2(-3) == 9);
+ BOOST_CHECK(s1(3) == 6);
+ } // s2 goes out of scope and disconnects
+
+ BOOST_CHECK(s1(3) == -3);
}
struct EventCounter
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk