Browse Source

GCC 4.5 compatibility: somehow can't use {} to construct from init-list.

Vladimír Vondruš 12 years ago
parent
commit
bbe19ab788
  1. 6
      src/Magnum/SceneGraph/AbstractObject.h
  2. 9
      src/Magnum/SceneGraph/Object.h
  3. 15
      src/Magnum/SceneGraph/Object.hpp

6
src/Magnum/SceneGraph/AbstractObject.h

@ -171,7 +171,8 @@ template<UnsignedInt dimensions, class T> class AbstractObject
/* Workarounds to avoid ambiguous overload errors on GCC < 4.8. And I
thought 4.7 was bug-free. */
std::vector<MatrixType> transformationMatrices(std::initializer_list<std::reference_wrapper<AbstractObject<dimensions, T>>>& objects, const MatrixType& initialTransformationMatrix = MatrixType()) {
return transformationMatrices(std::vector<std::reference_wrapper<AbstractObject<dimensions, T>>>{objects}, initialTransformationMatrix);
/* GCC 4.5 doesn't like {} here */
return transformationMatrices(std::vector<std::reference_wrapper<AbstractObject<dimensions, T>>>(objects), initialTransformationMatrix);
}
CORRADE_DEPRECATED("use transformationMatrices(const std::vector<std::reference_wrapper<AbstractObject<dimensions, T>>>&, const MatrixType&) instead") std::vector<MatrixType> transformationMatrices(std::initializer_list<AbstractObject<dimensions, T>*> objects, const MatrixType& initialTransformationMatrix = MatrixType()) const;
#endif
@ -209,7 +210,8 @@ template<UnsignedInt dimensions, class T> class AbstractObject
/* Workarounds to avoid ambiguous overload errors on GCC < 4.8. And I
thought 4.7 was bug-free. */
static void setClean(std::initializer_list<std::reference_wrapper<AbstractObject<dimensions, T>>> objects) {
return setClean(std::vector<std::reference_wrapper<AbstractObject<dimensions, T>>>{objects});
/* GCC 4.5 doesn't like {} here */
return setClean(std::vector<std::reference_wrapper<AbstractObject<dimensions, T>>>(objects));
}
static CORRADE_DEPRECATED("use setClean(const std::vector<std::reference_wrapper<AbstractObject<dimensions, T>>>&) instead") void setClean(std::initializer_list<AbstractObject<dimensions, T>*> objects);
#endif

9
src/Magnum/SceneGraph/Object.h

@ -263,7 +263,8 @@ template<class Transformation> class Object: public AbstractObject<Transformatio
/* Workarounds to avoid ambiguous overload errors on GCC < 4.8. And I
thought 4.7 was bug-free. */
std::vector<MatrixType> transformationMatrices(std::initializer_list<std::reference_wrapper<Object<Transformation>>> objects, const MatrixType& initialTransformationMatrix = MatrixType()) const {
return transformationMatrices(std::vector<std::reference_wrapper<Object<Transformation>>>{objects}, initialTransformationMatrix);
/* GCC 4.5 doesn't like {} here */
return transformationMatrices(std::vector<std::reference_wrapper<Object<Transformation>>>(objects), initialTransformationMatrix);
}
CORRADE_DEPRECATED("use transformationMatrices(const std::vector<std::reference_wrapper<Object<Transformation>>>&, const MatrixType&) instead") std::vector<MatrixType> transformationMatrices(std::initializer_list<Object<Transformation>*> objects, const MatrixType& initialTransformationMatrix = MatrixType()) const;
#endif
@ -292,7 +293,8 @@ template<class Transformation> class Object: public AbstractObject<Transformatio
/* Workarounds to avoid ambiguous overload errors on GCC < 4.8. And I
thought 4.7 was bug-free. */
std::vector<typename Transformation::DataType> transformations(std::initializer_list<std::reference_wrapper<Object<Transformation>>> objects, const typename Transformation::DataType& initialTransformation = typename Transformation::DataType()) const {
return transformations(std::vector<std::reference_wrapper<Object<Transformation>>>{objects}, initialTransformation);
/* GCC 4.5 doesn't like {} here */
return transformations(std::vector<std::reference_wrapper<Object<Transformation>>>(objects), initialTransformation);
}
CORRADE_DEPRECATED("use transformations(std::vector<std::reference_wrapper<Object<Transformation>>>, const typename Transformation::DataType&) instead") std::vector<typename Transformation::DataType> transformations(std::initializer_list<Object<Transformation>*> objects, const typename Transformation::DataType& initialTransformation = typename Transformation::DataType()) const;
#endif
@ -326,7 +328,8 @@ template<class Transformation> class Object: public AbstractObject<Transformatio
/* Workarounds to avoid ambiguous overload errors on GCC < 4.8. And I
thought 4.7 was bug-free. */
static void setClean(std::initializer_list<std::reference_wrapper<Object<Transformation>>> objects) {
setClean(std::vector<std::reference_wrapper<Object<Transformation>>>{objects});
/* GCC 4.5 doesn't like {} here */
setClean(std::vector<std::reference_wrapper<Object<Transformation>>>(objects));
}
static CORRADE_DEPRECATED("use setClean(std::vector<std::reference_wrapper<Object<Transformation>>>) instead") void setClean(std::initializer_list<Object<Transformation>*> objects);
#endif

15
src/Magnum/SceneGraph/Object.hpp

@ -52,7 +52,8 @@ template<UnsignedInt dimensions, class T> void AbstractObject<dimensions, T>::se
#ifdef CORRADE_GCC47_COMPATIBILITY
template<UnsignedInt dimensions, class T> void AbstractObject<dimensions, T>::setClean(std::initializer_list<AbstractObject<dimensions, T>*> objects) {
return setClean(std::vector<AbstractObject<dimensions, T>*>{objects});
/* GCC 4.5 doesn't like {} here */
return setClean(std::vector<AbstractObject<dimensions, T>*>(objects));
}
#endif
#endif
@ -74,7 +75,8 @@ template<UnsignedInt dimensions, class T> auto AbstractObject<dimensions, T>::tr
#ifdef CORRADE_GCC47_COMPATIBILITY
template<UnsignedInt dimensions, class T> auto AbstractObject<dimensions, T>::transformationMatrices(std::initializer_list<AbstractObject<dimensions, T>*> objects, const MatrixType& initialTransformationMatrix) const -> std::vector<MatrixType> {
return transformationMatrices(std::vector<AbstractObject<dimensions, T>*>{objects}, initialTransformationMatrix);
/* GCC 4.5 doesn't like {} here */
return transformationMatrices(std::vector<AbstractObject<dimensions, T>*>(objects), initialTransformationMatrix);
}
#endif
#endif
@ -236,7 +238,8 @@ template<class Transformation> auto Object<Transformation>::transformationMatric
#ifdef CORRADE_GCC47_COMPATIBILITY
template<class Transformation> auto Object<Transformation>::transformationMatrices(std::initializer_list<Object<Transformation>*> objects, const MatrixType& initialTransformationMatrix) const -> std::vector<MatrixType> {
return transformationMatrices(std::vector<Object<Transformation>*>{objects}, initialTransformationMatrix);
/* GCC 4.5 doesn't like {} here */
return transformationMatrices(std::vector<Object<Transformation>*>(objects), initialTransformationMatrix);
}
#endif
#endif
@ -369,7 +372,8 @@ template<class Transformation> std::vector<typename Transformation::DataType> Ob
#ifdef CORRADE_GCC47_COMPATIBILITY
template<class Transformation> std::vector<typename Transformation::DataType> Object<Transformation>::transformations(std::initializer_list<Object<Transformation>*> objects, const typename Transformation::DataType& initialTransformation) const {
return transformations(std::vector<Object<Transformation>*>{objects}, initialTransformation);
/* GCC 4.5 doesn't like {} here */
return transformations(std::vector<Object<Transformation>*>(objects), initialTransformation);
}
#endif
#endif
@ -487,7 +491,8 @@ template<class Transformation> void Object<Transformation>::setClean(const std::
#ifdef CORRADE_GCC47_COMPATIBILITY
template<class Transformation> void Object<Transformation>::setClean(std::initializer_list<Object<Transformation>*> objects) {
setClean(std::vector<Object<Transformation>*>{objects});
/* GCC 4.5 doesn't like {} here */
setClean(std::vector<Object<Transformation>*>(objects));
}
#endif
#endif

Loading…
Cancel
Save