The begin of story is from Code reuse in xepic, I try merge compiler and debugger runtime db code, and investigate the industry solution about this.

As I was writing some Rust code, and use serde , so I think I need something like it in c++. I find reflect-cpp , and begin to consider what is the essence of the problem ?

I find Andrei Alexandrescu representation about: Reflection and code generation and related post.

Rust does not actually have any introspection facilities at all, but it does have a mature code generation facility in the form of its declarative and procedural macros.

So after some solid thinking, I basically agree this viewpoint.

Rust programmers don’t have to deal with writing this boilerplate code, my purpose is avoid to write boilerplate code using cpp.

reflect-cpp is using template to avoid boilerplate code. And if code-generation is existed in cpp, we can easily do this.