adl_pointer.hpp 929 B

1234567891011121314151617181920212223242526272829303132333435
  1. #ifndef ENTT_META_ADL_POINTER_HPP
  2. #define ENTT_META_ADL_POINTER_HPP
  3. namespace entt {
  4. /**
  5. * @brief ADL based lookup function for dereferencing meta pointer-like types.
  6. * @tparam Type Element type.
  7. * @param value A pointer-like object.
  8. * @return The value returned from the dereferenced pointer.
  9. */
  10. template<typename Type>
  11. decltype(auto) dereference_meta_pointer_like(const Type &value) {
  12. return *value;
  13. }
  14. /**
  15. * @brief Fake ADL based lookup function for meta pointer-like types.
  16. * @tparam Type Element type.
  17. */
  18. template<typename Type>
  19. struct adl_meta_pointer_like {
  20. /**
  21. * @brief Uses the default ADL based lookup method to resolve the call.
  22. * @param value A pointer-like object.
  23. * @return The value returned from the dereferenced pointer.
  24. */
  25. static decltype(auto) dereference(const Type &value) {
  26. return dereference_meta_pointer_like(value);
  27. }
  28. };
  29. } // namespace entt
  30. #endif