From 4f224f672d0e97d10bb540d4cae04d7c99cb388f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sat, 2 Jun 2018 02:31:51 +0200 Subject: [PATCH] SceneGraph: fix ambiguous overloads with Animable and Drawable. If they are inherited from a class together with Object, the constructor call was ambiguous. This was already done for Camera, but not for these. --- src/Magnum/SceneGraph/Animable.h | 6 ++++++ src/Magnum/SceneGraph/Drawable.h | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/src/Magnum/SceneGraph/Animable.h b/src/Magnum/SceneGraph/Animable.h index 3d0854538..0980af250 100644 --- a/src/Magnum/SceneGraph/Animable.h +++ b/src/Magnum/SceneGraph/Animable.h @@ -129,6 +129,12 @@ template class Animable: public AbstractGrouped */ explicit Animable(AbstractObject& object, AnimableGroup* group = nullptr); + #ifndef DOXYGEN_GENERATING_OUTPUT + /* This is here to avoid ambiguity with deleted copy constructor when + passing `*this` from class subclassing both Animable and AbstractObject */ + template, U>::value>::type> explicit Animable(U& object): Animable{static_cast&>(object)} {} + #endif + ~Animable(); /** @brief Animation duration */ diff --git a/src/Magnum/SceneGraph/Drawable.h b/src/Magnum/SceneGraph/Drawable.h index b6d64ea25..ff5075865 100644 --- a/src/Magnum/SceneGraph/Drawable.h +++ b/src/Magnum/SceneGraph/Drawable.h @@ -111,6 +111,12 @@ template class Drawable: public AbstractGrouped */ explicit Drawable(AbstractObject& object, DrawableGroup* drawables = nullptr); + #ifndef DOXYGEN_GENERATING_OUTPUT + /* This is here to avoid ambiguity with deleted copy constructor when + passing `*this` from class subclassing both Drawable and AbstractObject */ + template, U>::value>::type> explicit Drawable(U& object): Drawable{static_cast&>(object)} {} + #endif + /** * @brief Group containing this drawable *