EnTT  3.10.0
resolve.hpp
1 #ifndef ENTT_META_RESOLVE_HPP
2 #define ENTT_META_RESOLVE_HPP
3 
4 #include <algorithm>
5 #include "../core/type_info.hpp"
6 #include "ctx.hpp"
7 #include "meta.hpp"
8 #include "node.hpp"
9 #include "range.hpp"
10 
11 namespace entt {
12 
18 template<typename Type>
19 [[nodiscard]] meta_type resolve() ENTT_NOEXCEPT {
20  return internal::meta_node<std::remove_cv_t<std::remove_reference_t<Type>>>::resolve();
21 }
22 
27 [[nodiscard]] inline meta_range<meta_type> resolve() ENTT_NOEXCEPT {
28  return *internal::meta_context::global();
29 }
30 
36 [[nodiscard]] inline meta_type resolve(const id_type id) ENTT_NOEXCEPT {
37  for(auto &&curr: resolve()) {
38  if(curr.id() == id) {
39  return curr;
40  }
41  }
42 
43  return {};
44 }
45 
51 [[nodiscard]] inline meta_type resolve(const type_info &info) ENTT_NOEXCEPT {
52  for(auto &&curr: resolve()) {
53  if(curr.info() == info) {
54  return curr;
55  }
56  }
57 
58  return {};
59 }
60 
61 } // namespace entt
62 
63 #endif
Opaque wrapper for types.
Definition: meta.hpp:949
EnTT default namespace.
Definition: dense_map.hpp:22
meta_type resolve()
Returns the meta type associated with a given type.
Definition: resolve.hpp:19
std::uint32_t id_type
Alias declaration for type identifiers.
Definition: fwd.hpp:14
Implementation specific information about a type.
Definition: type_info.hpp:141