Swift uses annotations (reflection) and generates bytecode on the fly. This fits much better with modern Java development practices and tooling than source code generation. Is such a thing feasible C++, especially in an idiomatic way? Or perhaps I am misunderstanding your question.
To my knowledge, our C++ Thrift code is here: https://github.com/facebook/fbthrift
(I work on Presto and occasionally Swift at Facebook, but am not at all familiar with modern C++)