| 88 | SECTION("Lifetime") |
| 89 | { |
| 90 | struct Lifetime |
| 91 | { |
| 92 | int* _constructed; |
| 93 | int* _destructed; |
| 94 | |
| 95 | Lifetime(int* constructed, int* destructed) |
| 96 | : _constructed(constructed) |
| 97 | , _destructed(destructed) |
| 98 | { |
| 99 | ++(*_constructed); |
| 100 | } |
| 101 | |
| 102 | Lifetime(Lifetime&& other) noexcept |
| 103 | : _constructed(other._constructed) |
| 104 | , _destructed(other._destructed) |
| 105 | { |
| 106 | ++(*_constructed); |
| 107 | } |
| 108 | |
| 109 | Lifetime() = delete; |
| 110 | Lifetime& operator=(const Lifetime&) = delete; |
| 111 | Lifetime& operator=(Lifetime&&) = delete; |
| 112 | |
| 113 | ~Lifetime() |
| 114 | { |
| 115 | ++(*_destructed); |
| 116 | } |
| 117 | }; |
| 118 | |
| 119 | int constructed = 0, destructed = 0; |
| 120 | REQUIRE(constructed == destructed); |