summaryrefslogtreecommitdiff
path: root/hitlist.h
diff options
context:
space:
mode:
authorKeuin <[email protected]>2022-04-21 15:46:28 +0800
committerKeuin <[email protected]>2022-04-21 16:26:40 +0800
commit40b96a150f25db34f5b213374fae0e74d02f0cc6 (patch)
tree518171120fc76d16d3e4740ec6fd52cc0cc7d8b4 /hitlist.h
parentc317366d5b60f7aa125f1c9f1878a9b01a6b9d66 (diff)
Copy and move semantic of hitlist.
Diffstat (limited to 'hitlist.h')
-rw-r--r--hitlist.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/hitlist.h b/hitlist.h
index 76832db..c804b4e 100644
--- a/hitlist.h
+++ b/hitlist.h
@@ -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) {