| 1 |
#if __cplusplus >= 201103L |
| 2 |
|
| 3 |
#include <memory> |
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
class TestSharedPtr { |
| 8 |
public: |
| 9 |
static int s_counter; |
| 10 |
|
| 11 |
public: |
| 12 |
TestSharedPtr() { ++s_counter; } |
| 13 |
TestSharedPtr(const TestSharedPtr&) { ++s_counter; } |
| 14 |
~TestSharedPtr() { --s_counter; } |
| 15 |
}; |
| 16 |
|
| 17 |
std::shared_ptr<TestSharedPtr> create_shared_ptr_instance(); |
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
class TestMoving1 { |
| 22 |
public: |
| 23 |
static int s_move_counter; |
| 24 |
|
| 25 |
public: |
| 26 |
TestMoving1() {} |
| 27 |
TestMoving1(TestMoving1&&) { ++s_move_counter; } |
| 28 |
TestMoving1(const TestMoving1&) {} |
| 29 |
TestMoving1& operator=(TestMoving1&&) { ++s_move_counter; return *this; } |
| 30 |
TestMoving1& operator=(TestMoving1&) { return *this; } |
| 31 |
}; |
| 32 |
|
| 33 |
class TestMoving2 { |
| 34 |
public: |
| 35 |
static int s_move_counter; |
| 36 |
|
| 37 |
public: |
| 38 |
TestMoving2() {} |
| 39 |
TestMoving2(const TestMoving2&) {} |
| 40 |
TestMoving2(TestMoving2&& other) { ++s_move_counter; } |
| 41 |
TestMoving2& operator=(TestMoving2&) { return *this; } |
| 42 |
TestMoving2& operator=(TestMoving2&&) { ++s_move_counter; return *this; } |
| 43 |
}; |
| 44 |
|
| 45 |
#endif |