| 254 | // ============================================================================ |
| 255 | |
| 256 | struct TestItem { |
| 257 | int value; |
| 258 | int move_count = 0; |
| 259 | int copy_count = 0; |
| 260 | |
| 261 | TestItem() : value(0) {} |
| 262 | explicit TestItem(int v) : value(v) {} |
| 263 | |
| 264 | // Move constructor - tracks moves |
| 265 | TestItem(TestItem&& other) noexcept |
| 266 | : value(other.value), move_count(other.move_count + 1) { |
| 267 | other.move_count++; |
| 268 | } |
| 269 | |
| 270 | // Move assignment |
| 271 | TestItem& operator=(TestItem&& other) noexcept { |
| 272 | value = other.value; |
| 273 | move_count = other.move_count + 1; |
| 274 | other.move_count++; |
| 275 | return *this; |
| 276 | } |
| 277 | |
| 278 | // Delete copy constructor - prevents accidental copies |
| 279 | TestItem(const TestItem&) = delete; |
| 280 | TestItem& operator=(const TestItem&) = delete; |
| 281 | |
| 282 | // Equality for checking values |
| 283 | bool operator==(const TestItem& other) const { |
| 284 | return value == other.value; |
| 285 | } |
| 286 | }; |
| 287 | |
| 288 | // ============================================================================ |
| 289 | // COMPONENT 3: TEMPLATED VALIDATORS |
no outgoing calls