diff --git a/doc/changelog.dox b/doc/changelog.dox index 5e5ffe45e..d2b4502b9 100644 --- a/doc/changelog.dox +++ b/doc/changelog.dox @@ -404,6 +404,9 @@ See also: - Improved @ref TextureTools::distanceField() to work better on shader compilers that have problems compiling nested loops (WebGL implementations, some ES2 devices) +- @ref SceneGraph::AbstractObject::addFeature() and + @ref SceneGraph::Object::addChild() were not properly forwarding reference + arguments @subsection changelog-latest-docs Documentation diff --git a/src/Magnum/SceneGraph/AbstractObject.h b/src/Magnum/SceneGraph/AbstractObject.h index dafa4d2af..cf8c83052 100644 --- a/src/Magnum/SceneGraph/AbstractObject.h +++ b/src/Magnum/SceneGraph/AbstractObject.h @@ -111,7 +111,7 @@ template class AbstractObject * Calling `object.addFeature(args...)` is equivalent to * `new MyFeature{object, args...}`. */ - template U& addFeature(Args... args) { + template U& addFeature(Args&&... args) { return *(new U{*this, std::forward(args)...}); } diff --git a/src/Magnum/SceneGraph/Object.h b/src/Magnum/SceneGraph/Object.h index 63f8b85ef..3c122138d 100644 --- a/src/Magnum/SceneGraph/Object.h +++ b/src/Magnum/SceneGraph/Object.h @@ -193,7 +193,7 @@ template class Object: public AbstractObject(args...)` is equivalent to * `new MyObject{args..., &object}`. */ - template T& addChild(Args... args) { + template T& addChild(Args&&... args) { return *(new T{std::forward(args)..., this}); }