diff options
| author | untodesu <kirill@untode.su> | 2025-03-15 16:22:09 +0500 |
|---|---|---|
| committer | untodesu <kirill@untode.su> | 2025-03-15 16:22:09 +0500 |
| commit | 3bf42c6ff3805a0d42bbc661794a95ff31bedc26 (patch) | |
| tree | 05049955847504808d6bed2bb7b155f8b03807bb /deps/include/entt/core/family.hpp | |
| parent | 02294547dcde0d4ad76e229106702261e9f10a51 (diff) | |
| download | voxelius-3bf42c6ff3805a0d42bbc661794a95ff31bedc26.tar.bz2 voxelius-3bf42c6ff3805a0d42bbc661794a95ff31bedc26.zip | |
Add whatever I was working on for the last month
Diffstat (limited to 'deps/include/entt/core/family.hpp')
| -rw-r--r-- | deps/include/entt/core/family.hpp | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/deps/include/entt/core/family.hpp b/deps/include/entt/core/family.hpp new file mode 100644 index 0000000..7c7f3e1 --- /dev/null +++ b/deps/include/entt/core/family.hpp @@ -0,0 +1,33 @@ +#ifndef ENTT_CORE_FAMILY_HPP
+#define ENTT_CORE_FAMILY_HPP
+
+#include "../config/config.h"
+#include "fwd.hpp"
+
+namespace entt {
+
+/**
+ * @brief Dynamic identifier generator.
+ *
+ * Utility class template that can be used to assign unique identifiers to types
+ * at runtime. Use different specializations to create separate sets of
+ * identifiers.
+ */
+template<typename...>
+class family {
+ // NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables)
+ inline static ENTT_MAYBE_ATOMIC(id_type) identifier{};
+
+public:
+ /*! @brief Unsigned integer type. */
+ using value_type = id_type;
+
+ /*! @brief Statically generated unique identifier for the given type. */
+ template<typename... Type>
+ // at the time I'm writing, clang crashes during compilation if auto is used instead of family_type
+ inline static const value_type value = identifier++;
+};
+
+} // namespace entt
+
+#endif
|
