diff options
author | Keuin <[email protected]> | 2022-04-21 15:46:28 +0800 |
---|---|---|
committer | Keuin <[email protected]> | 2022-04-21 16:26:40 +0800 |
commit | 40b96a150f25db34f5b213374fae0e74d02f0cc6 (patch) | |
tree | 518171120fc76d16d3e4740ec6fd52cc0cc7d8b4 /hitlist.h | |
parent | c317366d5b60f7aa125f1c9f1878a9b01a6b9d66 (diff) |
Copy and move semantic of hitlist.
Diffstat (limited to 'hitlist.h')
-rw-r--r-- | hitlist.h | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -30,7 +30,15 @@ class hitlist { public: hitlist() = default; - hitlist(hitlist &other) = delete; // do not copy the world + hitlist(hitlist &other) { + objects = other.objects; + } + + hitlist(hitlist &&other) noexcept { + objects = std::move(other.objects); + } + + hitlist &operator=(const hitlist &other) = default; // Add an object to the world. void add_object(std::shared_ptr<object> &&obj) { |