From b64a50c821b779a9ce99e9f7668cf9f49cb46ee4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sat, 8 Feb 2014 22:46:24 +0100 Subject: [PATCH] SceneGraph: avoid unnecessary copies in deprecated functions. Optimizations of deprecated API? What the hell am I doing? --- src/Magnum/SceneGraph/Object.h | 4 ++-- src/Magnum/SceneGraph/Object.hpp | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Magnum/SceneGraph/Object.h b/src/Magnum/SceneGraph/Object.h index 027d8b8f9..dfa95b132 100644 --- a/src/Magnum/SceneGraph/Object.h +++ b/src/Magnum/SceneGraph/Object.h @@ -284,7 +284,7 @@ template class Object: public AbstractObject>>, const typename Transformation::DataType&) * @deprecated Use @ref Magnum::SceneGraph::Object::transformations(std::vector>>, const typename Transformation::DataType&) "transformations(std::vector>>, const typename Transformation::DataType&)" instead. */ - CORRADE_DEPRECATED("use transformations(std::vector>>, const typename Transformation::DataType&) instead") std::vector transformations(std::vector*> objects, const typename Transformation::DataType& initialTransformation = typename Transformation::DataType()) const; + CORRADE_DEPRECATED("use transformations(std::vector>>, const typename Transformation::DataType&) instead") std::vector transformations(const std::vector*>& 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 Object: public AbstractObject>>) * @deprecated Use @ref Magnum::SceneGraph::Object::setClean(std::vector>> "setClean(std::vector>>" instead. */ - CORRADE_DEPRECATED("use setClean(std::vector>>) instead") static void setClean(std::vector*> objects); + CORRADE_DEPRECATED("use setClean(std::vector>>) instead") static void setClean(const std::vector*>& objects); #ifdef CORRADE_GCC47_COMPATIBILITY /* Workarounds to avoid ambiguous overload errors on GCC < 4.8. And I diff --git a/src/Magnum/SceneGraph/Object.hpp b/src/Magnum/SceneGraph/Object.hpp index 9b26614c3..6716902e2 100644 --- a/src/Magnum/SceneGraph/Object.hpp +++ b/src/Magnum/SceneGraph/Object.hpp @@ -347,7 +347,7 @@ template std::vector Ob } #ifdef MAGNUM_BUILD_DEPRECATED -template std::vector Object::transformations(std::vector*> objects, const typename Transformation::DataType& initialTransformation) const { +template std::vector Object::transformations(const std::vector*>& objects, const typename Transformation::DataType& initialTransformation) const { std::vector>> references; references.reserve(objects.size()); for(auto o: objects) { @@ -355,7 +355,7 @@ template std::vector Ob references.push_back(*o); } - return transformations(references, initialTransformation); + return transformations(std::move(references), initialTransformation); } #ifdef CORRADE_GCC47_COMPATIBILITY @@ -451,7 +451,7 @@ template void Object::setClean(std::vector } #ifdef MAGNUM_BUILD_DEPRECATED -template void Object::setClean(std::vector*> objects) { +template void Object::setClean(const std::vector*>& objects) { std::vector>> references; references.reserve(objects.size()); for(auto o: objects) { @@ -459,7 +459,7 @@ template void Object::setClean(std::vector references.push_back(*o); } - setClean(references); + setClean(std::move(references)); } #ifdef CORRADE_GCC47_COMPATIBILITY