EnTT: src/entt/meta/context.hpp Source File

EnTT 3.16.0

Loading...
Searching...
No Matches
context.hpp
1#ifndef ENTT_META_CTX_HPP
2#define ENTT_META_CTX_HPP
3
4#include <memory>
5#include "../container/dense_map.hpp"
6#include "../core/fwd.hpp"
7#include "../core/utility.hpp"
8#include "fwd.hpp"
9
10namespace entt {
11
13namespace internal {
14
15struct meta_type_node;
16
17struct meta_context {
18 dense_map<id_type, std::unique_ptr<meta_type_node>, identity> value;
19
20 [[nodiscard]] inline static meta_context &from(meta_ctx &);
21 [[nodiscard]] inline static const meta_context &from(const meta_ctx &);
22};
23
24} // namespace internal
26
28 class meta_ctx_arg_t final {};
29
31 inline constexpr meta_ctx_arg_t meta_ctx_arg{};
32
34 class meta_ctx: private internal::meta_context {
35 // attorney idiom like model to access the base class
36 friend struct internal::meta_context;
37};
38
40[[nodiscard]] inline internal::meta_context &internal::meta_context::from(meta_ctx &ctx) {
41 return ctx;
42}
43
44[[nodiscard]] inline const internal::meta_context &internal::meta_context::from(const meta_ctx &ctx) {
45 return ctx;
46}
48
49} // namespace entt
50
51#endif
entt::meta_ctx_arg_t
Disambiguation tag for constructors and the like.
Definition context.hpp:28
entt::meta_ctx
Opaque meta context type.
Definition context.hpp:34
entt
EnTT default namespace.
Definition dense_map.hpp:22
entt::meta_ctx_arg
constexpr meta_ctx_arg_t meta_ctx_arg
Constant of type meta_context_arg_t used to disambiguate calls.
Definition context.hpp:31