Skip to content

armgit / godot

Public Imported from GitHub
0

Godot Engine – Multi-platform 2D and 3D game engine

Core: Use `std::forward()` on `Ref<T>::instantiate()` arguments

Thaddeus Crews0191a29f8560
diff --git a/core/object/ref_counted.h b/core/object/ref_counted.h
index 50275f490c8..3adc21192f5 100644
--- a/core/object/ref_counted.h
+++ b/core/object/ref_counted.h
@@ -212,9 +212,9 @@ public:
}
}
- template <typename... VarArgs>
- void instantiate(VarArgs... p_params) {
- Ref<T> ref = memnew(T(p_params...));
+ template <typename... Args>
+ void instantiate(Args &&...p_params) {
+ Ref<T> ref = memnew(T(std::forward<Args>(p_params)...));
// Appropriate the new Ref, and if the previous one was set, free it.
SWAP(reference, ref.reference);
}