EnTT 3.14.0
Loading...
Searching...
No Matches
context.hpp
1#ifndef ENTT_META_CTX_HPP
2#define ENTT_META_CTX_HPP
3
4#include "../container/dense_map.hpp"
5#include "../core/fwd.hpp"
6#include "../core/utility.hpp"
7
8namespace entt {
9
10class meta_ctx;
11
13namespace internal {
14
15struct meta_type_node;
16
17struct meta_context {
18 dense_map<id_type, meta_type_node, identity> value{};
19
20 [[nodiscard]] inline static meta_context &from(meta_ctx &ctx);
21 [[nodiscard]] inline static const meta_context &from(const meta_ctx &ctx);
22};
23
24} // namespace internal
29
31inline constexpr meta_ctx_arg_t meta_ctx_arg{};
32
34class 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}
49} // namespace entt
50
51#endif
Disambiguation tag for constructors and the like.
Definition context.hpp:28
Opaque meta context type.
Definition context.hpp:34
EnTT default namespace.
Definition dense_map.hpp:22
constexpr Type make_obj_using_allocator(const Allocator &allocator, Args &&...args)
Uses-allocator construction utility (waiting for C++20).
Definition memory.hpp:219
constexpr meta_ctx_arg_t meta_ctx_arg
Constant of type meta_context_arg_t used to disambiguate calls.
Definition context.hpp:31