aboutsummaryrefslogtreecommitdiff
path: root/src/crepe/util/Private.hpp
diff options
context:
space:
mode:
authorLoek Le Blansch <loek@pipeframe.xyz>2024-11-29 17:30:45 +0100
committerLoek Le Blansch <loek@pipeframe.xyz>2024-11-29 17:30:45 +0100
commit693355f55193cb2ea4c29616073227e37665afc1 (patch)
tree37d2bd3e916b909fbac58ae836e8001166edf384 /src/crepe/util/Private.hpp
parentc59d460f12e1393e0ddbaaa1c6f5522eb12f8ff9 (diff)
more audio system WIP
Diffstat (limited to 'src/crepe/util/Private.hpp')
-rw-r--r--src/crepe/util/Private.hpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/crepe/util/Private.hpp b/src/crepe/util/Private.hpp
index 30c8146..d6ab23f 100644
--- a/src/crepe/util/Private.hpp
+++ b/src/crepe/util/Private.hpp
@@ -8,13 +8,15 @@
namespace crepe {
template <typename T, typename... Args>
-void Private::set(Args &&... args) {
+T & Private::set(Args &&... args) {
+ if (!this->empty()) this->destructor(this->instance);
T * instance = new T(std::forward<Args>(args)...);
this->instance = static_cast<void*>(instance);
this->destructor = [](void * instance) {
delete static_cast<T*>(instance);
};
this->type = typeid(T);
+ return *instance;
}
template <typename T>