From dc21ce532b56b56b1b60ff1bbe5726eff83e4dd5 Mon Sep 17 00:00:00 2001 From: Mel Date: Sun, 14 Apr 2024 22:47:08 +0200 Subject: Fix SIOF [1] in asset system and rework for better flexibility [1]: https://en.cppreference.com/w/cpp/language/siof --- src/Common/Unique.hpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 src/Common/Unique.hpp (limited to 'src/Common') 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__) -- cgit 1.4.1