]> git.tdb.fi Git - libs/game.git/blobdiff - source/game/owned.h
Tweak the constructors of Owned
[libs/game.git] / source / game / owned.h
index 620c6aab54e2114a7e3c718256fb794a92593d47..b305ae21d1aea7f371ab5b9a661f00f09153841b 100644 (file)
@@ -21,6 +21,10 @@ public:
        Owned(Handle<P>, Args &&...);
 
        template<typename P, typename... Args>
+       Owned(Owned<P> &p, Args &&... a): Owned(static_cast<Handle<P> &>(p), std::forward<Args>(a)...) { }
+
+       template<typename P, typename... Args>
+               requires(!std::is_const_v<P>)
        Owned(P &parent, Args &&... args): Owned(Handle<P>::from_object(&parent), std::forward<Args>(args)...) { }
 
        Owned(Owned &&other): Handle<T>(other) { other.ptr = nullptr; }