Simple tool to provide reflection/introspection information.
- Build the inspecto executable
- Use
inspecto sample/test.cpp
to parse and generate constexpr representation of classes and structures. - Include
instrospecto.h
and write common code that uses the interface
#include "person.hpp"
#include <introspecto.h>
#include <iostream>
int main() {
Person person{18, "ze zim"};
auto personInfo = introspecto::introspect(person);
personInfo.foreachField(
[](const std::string_view name, const auto value) {
std::cout << name << " = " << value << '\n';
});
}
- C++ STL (commonly already included in the toolchain/OS)
- GCC compiler with C++23 support (commonly the default compiler)
- Clang + LLVM with C++2b support (easy to install using any package manager)