pointer.hpp 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #ifndef ENTT_META_POINTER_HPP
  2. #define ENTT_META_POINTER_HPP
  3. #include <memory>
  4. #include <type_traits>
  5. #include "type_traits.hpp"
  6. namespace entt {
  7. /**
  8. * @brief Makes plain pointers pointer-like types for the meta system.
  9. * @tparam Type Element type.
  10. */
  11. template<typename Type>
  12. struct is_meta_pointer_like<Type *>
  13. : std::true_type {};
  14. /**
  15. * @brief Partial specialization used to reject pointers to arrays.
  16. * @tparam Type Type of elements of the array.
  17. * @tparam N Number of elements of the array.
  18. */
  19. template<typename Type, std::size_t N>
  20. struct is_meta_pointer_like<Type (*)[N]>
  21. : std::false_type {};
  22. /**
  23. * @brief Makes `std::shared_ptr`s of any type pointer-like types for the meta
  24. * system.
  25. * @tparam Type Element type.
  26. */
  27. template<typename Type>
  28. struct is_meta_pointer_like<std::shared_ptr<Type>>
  29. : std::true_type {};
  30. /**
  31. * @brief Makes `std::unique_ptr`s of any type pointer-like types for the meta
  32. * system.
  33. * @tparam Type Element type.
  34. * @tparam Args Other arguments.
  35. */
  36. template<typename Type, typename... Args>
  37. struct is_meta_pointer_like<std::unique_ptr<Type, Args...>>
  38. : std::true_type {};
  39. } // namespace entt
  40. #endif