X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fgame%2Fowned.h;h=7159c7d9622a06fd83301b7565dc1d55c0beedcc;hb=fce6e7846814e54de9d38000d2f5e2295ee2119e;hp=620c6aab54e2114a7e3c718256fb794a92593d47;hpb=f93a0f0afe8aff4d0bbc8ee393918881cfdd9db8;p=libs%2Fgame.git diff --git a/source/game/owned.h b/source/game/owned.h index 620c6aa..7159c7d 100644 --- a/source/game/owned.h +++ b/source/game/owned.h @@ -21,6 +21,10 @@ public: Owned(Handle

, Args &&...); template + Owned(Owned

&p, Args &&... a): Owned(static_cast &>(p), std::forward(a)...) { } + + template + requires(!std::is_const_v

) Owned(P &parent, Args &&... args): Owned(Handle

::from_object(&parent), std::forward(args)...) { } Owned(Owned &&other): Handle(other) { other.ptr = nullptr; } @@ -43,7 +47,7 @@ Owned::Owned(Handle

parent, Args &&... args) throw std::invalid_argument("Owned::Owned"); Stage &stage = get_stage(*parent); - Pool &pool = stage.get_pools().template get_pool(); + Pool &pool = stage.get_pools().get_pool(); this->ptr = pool.create(parent, std::forward(args)...); if constexpr(std::is_base_of_v) { @@ -98,7 +102,7 @@ void Owned::destroy() parent->remove_child(*this); } - Pool &pool = stage.get_pools().template get_pool(); + Pool &pool = stage.get_pools().get_pool(); pool.destroy(this->ptr); }