Skip to content

Reflection

Alan Jefferson edited this page Nov 2, 2019 · 1 revision

EnTT enables you to return the name of a component, along with names and values of its member variables by using entt::meta.

struct Position {
  float x, y, z;
};

entt::meta<Position>()
  .type("Position"_hs)
  .data<&Position::x>("x"_hs)
  .data<&Position::y>("y"_hs)
  .data<&Position::z>("z"_hs);

However the features are incomplete and early (first version implemented around October 2019). They are also independent of EnTT and are probably better suited for a separate project altogether.

Alternatives

In order of relevance, as most of these focus on I/O rather than just reflection.

  • RTTR
  • Cista
  • Protocol Buffers
  • Cap’n Proto
  • Flatbuffers
  • cereal
  • Boost Serialization
  • MessagePack