From 40b96a150f25db34f5b213374fae0e74d02f0cc6 Mon Sep 17 00:00:00 2001 From: Keuin Date: Thu, 21 Apr 2022 15:46:28 +0800 Subject: Copy and move semantic of hitlist. --- hitlist.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'hitlist.h') 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 &&obj) { -- cgit v1.2.3