|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r51036 - sandbox/thread_safe_signals/trunk/libs/signals2/test
From: fmhess_at_[hidden]
Date: 2009-02-05 15:57:09
Author: fmhess
Date: 2009-02-05 15:57:09 EST (Thu, 05 Feb 2009)
New Revision: 51036
URL: http://svn.boost.org/trac/boost/changeset/51036
Log:
Added test for deconstruct on a class derived from enable_shared_from_this.
Text files modified:
sandbox/thread_safe_signals/trunk/libs/signals2/test/deconstruct_test.cpp | 14 +++++++++++++-
1 files changed, 13 insertions(+), 1 deletions(-)
Modified: sandbox/thread_safe_signals/trunk/libs/signals2/test/deconstruct_test.cpp
==============================================================================
--- sandbox/thread_safe_signals/trunk/libs/signals2/test/deconstruct_test.cpp (original)
+++ sandbox/thread_safe_signals/trunk/libs/signals2/test/deconstruct_test.cpp 2009-02-05 15:57:09 EST (Thu, 05 Feb 2009)
@@ -7,10 +7,11 @@
// See http://www.boost.org/libs/signals2 for library home page.
+#include <boost/enable_shared_from_this.hpp>
#include <boost/shared_ptr.hpp>
-#include <boost/test/minimal.hpp>
#include <boost/signals2/deconstruct.hpp>
#include <boost/signals2/deconstruct_ptr.hpp>
+#include <boost/test/minimal.hpp>
class X: public boost::signals2::postconstructible {
public:
@@ -122,6 +123,13 @@
}
}
+class deconstructed_esft : public boost::enable_shared_from_this<deconstructed_esft>
+{
+ friend void adl_postconstruct(boost::shared_ptr<void>, deconstructed_esft *)
+ {}
+ int x;
+};
+
void deconstruct_test()
{
{
@@ -149,6 +157,10 @@
boost::shared_ptr<mytest::A> a = boost::signals2::deconstruct<mytest::A>().postconstruct(2);
BOOST_CHECK(a->value == 2);
}
+ {// enable_shared_from_this with deconstruct
+ boost::shared_ptr<deconstructed_esft> a = boost::signals2::deconstruct<deconstructed_esft>();
+ BOOST_CHECK(!(a->shared_from_this() < a || a < a->shared_from_this()));
+ }
}
int test_main(int, char*[])
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