🛠️🐜 Antkeeper superbuild with dependencies included https://antkeeper.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
828 B

  1. #ifndef ENTT_CORE_FAMILY_HPP
  2. #define ENTT_CORE_FAMILY_HPP
  3. #include "../config/config.h"
  4. #include "fwd.hpp"
  5. namespace entt {
  6. /**
  7. * @brief Dynamic identifier generator.
  8. *
  9. * Utility class template that can be used to assign unique identifiers to types
  10. * at runtime. Use different specializations to create separate sets of
  11. * identifiers.
  12. */
  13. template<typename...>
  14. class family {
  15. inline static ENTT_MAYBE_ATOMIC(id_type) identifier{};
  16. public:
  17. /*! @brief Unsigned integer type. */
  18. using family_type = id_type;
  19. /*! @brief Statically generated unique identifier for the given type. */
  20. template<typename... Type>
  21. // at the time I'm writing, clang crashes during compilation if auto is used instead of family_type
  22. inline static const family_type type = identifier++;
  23. };
  24. } // namespace entt
  25. #endif