Skip to content

Latest commit

 

History

History
34 lines (24 loc) · 883 Bytes

README.md

File metadata and controls

34 lines (24 loc) · 883 Bytes

Introspecto C++

Simple tool to provide reflection/introspection information.

How it works

  1. Build the inspecto executable
  2. Use inspecto sample/test.cpp to parse and generate constexpr representation of classes and structures.
  3. 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';
      });
}

Dependencies

  • 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)