EnTT  3.5.2
resolve.hpp
1 #ifndef ENTT_META_RESOLVE_HPP
2 #define ENTT_META_RESOLVE_HPP
3 
4 
5 #include <algorithm>
6 #include "ctx.hpp"
7 #include "meta.hpp"
8 #include "range.hpp"
9 
10 
11 namespace entt {
12 
13 
19 template<typename Type>
20 [[nodiscard]] meta_type resolve() ENTT_NOEXCEPT {
21  return internal::meta_info<Type>::resolve();
22 }
23 
24 
29 [[nodiscard]] inline meta_range<meta_type> resolve() {
30  return *internal::meta_context::global();
31 }
32 
33 
39 [[nodiscard]] inline meta_type resolve_id(const id_type id) ENTT_NOEXCEPT {
40  internal::meta_range range{*internal::meta_context::global()};
41  return std::find_if(range.begin(), range.end(), [id](const auto &curr) { return curr.id == id; }).operator->();
42 }
43 
44 
50 [[nodiscard]] inline meta_type resolve_type(const id_type id) ENTT_NOEXCEPT {
51  internal::meta_range range{*internal::meta_context::global()};
52  return std::find_if(range.begin(), range.end(), [id](const auto &curr) { return curr.type_id == id; }).operator->();
53 }
54 
55 
56 }
57 
58 
59 #endif
entt::resolve_type
meta_type resolve_type(const id_type id) noexcept
Returns the meta type associated with a given type id, if any.
Definition: resolve.hpp:50
entt::id_type
std::uint32_t id_type
Alias declaration for type identifiers.
Definition: fwd.hpp:12
entt::resolve_id
meta_type resolve_id(const id_type id) noexcept
Returns the meta type associated with a given identifier, if any.
Definition: resolve.hpp:39
entt
EnTT default namespace.
Definition: algorithm.hpp:13
entt::resolve
meta_type resolve() noexcept
Returns the meta type associated with a given type.
Definition: resolve.hpp:20
entt::meta_type
Opaque wrapper for meta types.
Definition: meta.hpp:1006