From: Mikko Rasa Date: Sat, 29 Oct 2022 17:24:39 +0000 (+0300) Subject: Tweak the constructors of Owned X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=33aed7ee82844023346f8cb9c3108cb0d6c80369;p=libs%2Fgame.git Tweak the constructors of Owned This makes it not break if an Owned is passed as the first argument. --- diff --git a/source/game/owned.h b/source/game/owned.h index 620c6aa..b305ae2 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; }