summary refs log tree commit diff
path: root/src/Common/Unique.hpp
diff options
context:
space:
mode:
authorMel <einebeere@gmail.com>2024-04-14 22:47:08 +0200
committerMel <einebeere@gmail.com>2024-04-14 22:47:08 +0200
commitdc21ce532b56b56b1b60ff1bbe5726eff83e4dd5 (patch)
tree6166201c0543e72ecb77c715105e9a4bba06e796 /src/Common/Unique.hpp
parent0b2474a476b8d54967c7362c2d6bdfc76af1f05b (diff)
downloadmeowcraft-dc21ce532b56b56b1b60ff1bbe5726eff83e4dd5.tar.zst
meowcraft-dc21ce532b56b56b1b60ff1bbe5726eff83e4dd5.zip
Fix SIOF [1] in asset system and rework for better flexibility
[1]: https://en.cppreference.com/w/cpp/language/siof
Diffstat (limited to 'src/Common/Unique.hpp')
-rw-r--r--src/Common/Unique.hpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/Common/Unique.hpp b/src/Common/Unique.hpp
new file mode 100644
index 0000000..147fb0e
--- /dev/null
+++ b/src/Common/Unique.hpp
@@ -0,0 +1,12 @@
+#pragma once
+
+// TODO: Put this macro in it's own Common header,
+// it's useful often.
+#define _UNIQUE_CONCAT(a, b) _UNIQUE_CONCAT2(a, b)
+#define _UNIQUE_CONCAT2(a, b) a##b
+
+#define _UNIQUE_NAME_PREFIX _unique_name_
+#define UNIQUE_NAME _UNIQUE_CONCAT(_UNIQUE_NAME_PREFIX, __COUNTER__)
+
+#define _UNIQUE_NUMBER_PREFIX 0xAEF
+#define UNIQUE_NUMBER _UNIQUE_CONCAT(_UNIQUE_NUMBER_PREFIX, __COUNTER__)