Browse Source

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.
pull/255/head
Vladimír Vondruš 8 years ago
parent
commit
4f224f672d
  1. 6
      src/Magnum/SceneGraph/Animable.h
  2. 6
      src/Magnum/SceneGraph/Drawable.h

6
src/Magnum/SceneGraph/Animable.h

@ -129,6 +129,12 @@ template<UnsignedInt dimensions, class T> class Animable: public AbstractGrouped
*/
explicit Animable(AbstractObject<dimensions, T>& object, AnimableGroup<dimensions, T>* 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<class U, class = typename std::enable_if<std::is_base_of<AbstractObject<dimensions, T>, U>::value>::type> explicit Animable(U& object): Animable<dimensions, T>{static_cast<AbstractObject<dimensions, T>&>(object)} {}
#endif
~Animable();
/** @brief Animation duration */

6
src/Magnum/SceneGraph/Drawable.h

@ -111,6 +111,12 @@ template<UnsignedInt dimensions, class T> class Drawable: public AbstractGrouped
*/
explicit Drawable(AbstractObject<dimensions, T>& object, DrawableGroup<dimensions, T>* 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<class U, class = typename std::enable_if<std::is_base_of<AbstractObject<dimensions, T>, U>::value>::type> explicit Drawable(U& object): Drawable<dimensions, T>{static_cast<AbstractObject<dimensions, T>&>(object)} {}
#endif
/**
* @brief Group containing this drawable
*

Loading…
Cancel
Save