aboutsummaryrefslogtreecommitdiff
path: root/src/crepe/util/Private.h
diff options
context:
space:
mode:
authorLoek Le Blansch <loek@pipeframe.xyz>2024-11-29 16:23:52 +0100
committerLoek Le Blansch <loek@pipeframe.xyz>2024-11-29 16:23:52 +0100
commitc59d460f12e1393e0ddbaaa1c6f5522eb12f8ff9 (patch)
treee7d7ceabbb5b538b8fc57704750ccae9135be735 /src/crepe/util/Private.h
parentc2ef6a36532c8c078fd7836325d6be277b946cbf (diff)
more utility classes for Audio system
Diffstat (limited to 'src/crepe/util/Private.h')
-rw-r--r--src/crepe/util/Private.h34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/crepe/util/Private.h b/src/crepe/util/Private.h
new file mode 100644
index 0000000..fc3728f
--- /dev/null
+++ b/src/crepe/util/Private.h
@@ -0,0 +1,34 @@
+#pragma once
+
+#include <typeindex>
+#include <functional>
+
+namespace crepe {
+
+class Private {
+public:
+ Private() = default;
+ ~Private();
+ Private(Private &&);
+ Private & operator=(Private &&);
+ Private(const Private &) = delete;
+ Private & operator=(const Private &) = delete;
+
+ template <typename T>
+ T & get();
+
+ template <typename T, typename... Args>
+ void set(Args &&... args);
+
+ bool empty() const noexcept;
+
+private:
+ std::function<void(void *)> destructor;
+ std::type_index type = typeid(void);
+ void * instance = nullptr;
+};
+
+}
+
+#include "Private.hpp"
+