Skip to content

A system for adding full reflection and AST access at runtime to your project

License

Notifications You must be signed in to change notification settings

jer-irl/cpp-reflect

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cpp-reflect

Language-level reflection for C++ has a long and uncertain road ahead of it, and it appears less and less work being put into it ([https://lists.isocpp.org/sg7/]).

This project was an effort to provide build tooling for embedding Clang AST information about source code into the built binary, and then provide APIs for accessing the AST information from within that program at runtime.

Status

Partial proof of concept functional, abandoned.

Related work

Beyond interesting work on successor languages, for C++ "reflection" there are some interesting projects worth checking out.

  • Neargye/magic_enum involves some clever use of compiler predefined macros such as __PRETTY_FUNCTION__, expanding and parsing at compile time in order to get compile time reflection information. This technique could probably be extended more generally to functions etc., likely with more limitations between different compilers though.
  • felixguendling/cista does struct reflection for implementing "automatic" serialization. This technique relies on some useful properties of C++17 structured bindings, plus some clever tricks as originally (I think) described in this blog post.

About

A system for adding full reflection and AST access at runtime to your project

Topics

Resources

License

Stars

Watchers

Forks