Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygenshared_ptr_test.cpp
Go to the documentation of this file.
00001 #include <memory> 00002 00003 #if !defined(_STLP_NO_EXTENSIONS) && defined(_STLP_USE_BOOST_SUPPORT) 00004 00005 // #include <typeinfo> 00006 #include "cppunit/cppunit_proxy.h" 00007 00008 #if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES) 00009 using namespace std; 00010 #endif 00011 00012 class SharedPtrTest : 00013 public CPPUNIT_NS::TestCase 00014 { 00015 CPPUNIT_TEST_SUITE(SharedPtrTest); 00016 CPPUNIT_TEST(shared_from_this); 00017 CPPUNIT_TEST_SUITE_END(); 00018 00019 protected: 00020 void shared_from_this(); 00021 }; 00022 00023 CPPUNIT_TEST_SUITE_REGISTRATION(SharedPtrTest); 00024 00025 struct X; 00026 00027 struct X : 00028 public std::tr1::enable_shared_from_this<X> 00029 { 00030 }; 00031 00032 void SharedPtrTest::shared_from_this() 00033 { 00034 std::tr1::shared_ptr<X> p( new X ); 00035 std::tr1::shared_ptr<X> q = p->shared_from_this(); 00036 00037 CPPUNIT_CHECK( p == q ); 00038 CPPUNIT_CHECK( !(p < q) && !(q < p) ); // p and q share ownership 00039 } 00040 00041 #endif /* !_STLP_NO_EXTENSIONS && _STLP_USE_BOOST_SUPPORT */ Generated on Fri May 25 2012 04:34:14 for ReactOS by
1.7.6.1
|