EnTT 4.0.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 "../stl/functional.hpp"
7#include "../stl/memory.hpp"
8#include "fwd.hpp"
9
10namespace entt {
11
13namespace internal {
14
15struct meta_type_node;
16
17struct meta_context {
18 using bucket_type = dense_map<id_type, stl::unique_ptr<meta_type_node>, stl::identity>;
19
20 bucket_type bucket;
21
22 [[nodiscard]] inline static meta_context &from(meta_ctx &);
23 [[nodiscard]] inline static const meta_context &from(const meta_ctx &);
24};
25
26} // namespace internal
28
30struct meta_ctx: private internal::meta_context {
31 // attorney idiom like model to access the base class
32 friend struct internal::meta_context;
33};
34
36[[nodiscard]] inline internal::meta_context &internal::meta_context::from(meta_ctx &ctx) {
37 return ctx;
38}
39
40[[nodiscard]] inline const internal::meta_context &internal::meta_context::from(const meta_ctx &ctx) {
41 return ctx;
42}
44
45} // namespace entt
46
47#endif
EnTT default namespace.
Definition dense_map.hpp:25
Opaque meta context type.
Definition context.hpp:30