ReactOS 0.4.16-dev-340-g0540c21
shared_ptr_test.cpp
Go to the documentation of this file.
1#include <memory>
2
3#if !defined(_STLP_NO_EXTENSIONS) && defined(_STLP_USE_BOOST_SUPPORT)
4
5// #include <typeinfo>
7
8#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
9using namespace std;
10#endif
11
12class SharedPtrTest :
13 public CPPUNIT_NS::TestCase
14{
15 CPPUNIT_TEST_SUITE(SharedPtrTest);
16 CPPUNIT_TEST(shared_from_this);
18
19 protected:
20 void shared_from_this();
21};
22
24
25struct X;
26
27struct X :
28 public std::tr1::enable_shared_from_this<X>
29{
30};
31
32void SharedPtrTest::shared_from_this()
33{
34 std::tr1::shared_ptr<X> p( new X );
35 std::tr1::shared_ptr<X> q = p->shared_from_this();
36
37 CPPUNIT_CHECK( p == q );
38 CPPUNIT_CHECK( !(p < q) && !(q < p) ); // p and q share ownership
39}
40
41#endif /* !_STLP_NO_EXTENSIONS && _STLP_USE_BOOST_SUPPORT */
#define CPPUNIT_CHECK(X)
Definition: cppunit_mini.h:195
#define CPPUNIT_TEST_SUITE_END()
Definition: cppunit_mini.h:191
#define CPPUNIT_TEST(X)
Definition: cppunit_mini.h:182
#define CPPUNIT_TEST_SUITE_REGISTRATION(X)
Definition: cppunit_mini.h:193
#define CPPUNIT_TEST_SUITE(X)
Definition: cppunit_mini.h:142
GLdouble GLdouble GLdouble GLdouble q
Definition: gl.h:2063
GLfloat GLfloat p
Definition: glext.h:8902
Definition: features.h:417