Browse Source

SceneGraph: avoid unnecessary copies in deprecated functions.

Optimizations of deprecated API? What the hell am I doing?
pull/51/head
Vladimír Vondruš 12 years ago
parent
commit
b64a50c821
  1. 4
      src/Magnum/SceneGraph/Object.h
  2. 8
      src/Magnum/SceneGraph/Object.hpp

4
src/Magnum/SceneGraph/Object.h

@ -284,7 +284,7 @@ template<class Transformation> class Object: public AbstractObject<Transformatio
* @copybrief transformations(std::vector<std::reference_wrapper<Object<Transformation>>>, const typename Transformation::DataType&)
* @deprecated Use @ref Magnum::SceneGraph::Object::transformations(std::vector<std::reference_wrapper<Object<Transformation>>>, const typename Transformation::DataType&) "transformations(std::vector<std::reference_wrapper<Object<Transformation>>>, const typename Transformation::DataType&)" instead.
*/
CORRADE_DEPRECATED("use transformations(std::vector<std::reference_wrapper<Object<Transformation>>>, const typename Transformation::DataType&) instead") std::vector<typename Transformation::DataType> transformations(std::vector<Object<Transformation>*> objects, const typename Transformation::DataType& initialTransformation = typename Transformation::DataType()) const;
CORRADE_DEPRECATED("use transformations(std::vector<std::reference_wrapper<Object<Transformation>>>, const typename Transformation::DataType&) instead") std::vector<typename Transformation::DataType> transformations(const std::vector<Object<Transformation>*>& objects, const typename Transformation::DataType& initialTransformation = typename Transformation::DataType()) const;
#ifdef CORRADE_GCC47_COMPATIBILITY
/* Workarounds to avoid ambiguous overload errors on GCC < 4.8. And I
@ -318,7 +318,7 @@ template<class Transformation> class Object: public AbstractObject<Transformatio
* @copybrief setClean(std::vector<std::reference_wrapper<Object<Transformation>>>)
* @deprecated Use @ref Magnum::SceneGraph::Object::setClean(std::vector<std::reference_wrapper<Object<Transformation>>> "setClean(std::vector<std::reference_wrapper<Object<Transformation>>>" instead.
*/
CORRADE_DEPRECATED("use setClean(std::vector<std::reference_wrapper<Object<Transformation>>>) instead") static void setClean(std::vector<Object<Transformation>*> objects);
CORRADE_DEPRECATED("use setClean(std::vector<std::reference_wrapper<Object<Transformation>>>) instead") static void setClean(const std::vector<Object<Transformation>*>& objects);
#ifdef CORRADE_GCC47_COMPATIBILITY
/* Workarounds to avoid ambiguous overload errors on GCC < 4.8. And I

8
src/Magnum/SceneGraph/Object.hpp

@ -347,7 +347,7 @@ template<class Transformation> std::vector<typename Transformation::DataType> Ob
}
#ifdef MAGNUM_BUILD_DEPRECATED
template<class Transformation> std::vector<typename Transformation::DataType> Object<Transformation>::transformations(std::vector<Object<Transformation>*> objects, const typename Transformation::DataType& initialTransformation) const {
template<class Transformation> std::vector<typename Transformation::DataType> Object<Transformation>::transformations(const std::vector<Object<Transformation>*>& objects, const typename Transformation::DataType& initialTransformation) const {
std::vector<std::reference_wrapper<Object<Transformation>>> references;
references.reserve(objects.size());
for(auto o: objects) {
@ -355,7 +355,7 @@ template<class Transformation> std::vector<typename Transformation::DataType> Ob
references.push_back(*o);
}
return transformations(references, initialTransformation);
return transformations(std::move(references), initialTransformation);
}
#ifdef CORRADE_GCC47_COMPATIBILITY
@ -451,7 +451,7 @@ template<class Transformation> void Object<Transformation>::setClean(std::vector
}
#ifdef MAGNUM_BUILD_DEPRECATED
template<class Transformation> void Object<Transformation>::setClean(std::vector<Object<Transformation>*> objects) {
template<class Transformation> void Object<Transformation>::setClean(const std::vector<Object<Transformation>*>& objects) {
std::vector<std::reference_wrapper<Object<Transformation>>> references;
references.reserve(objects.size());
for(auto o: objects) {
@ -459,7 +459,7 @@ template<class Transformation> void Object<Transformation>::setClean(std::vector
references.push_back(*o);
}
setClean(references);
setClean(std::move(references));
}
#ifdef CORRADE_GCC47_COMPATIBILITY

Loading…
Cancel
Save