Compares C++26's value-based reflection model with the older Reflection Technical Specification's type-based approach by implementing a structural type trait. The value-based model uses new syntax (^^E and [: r :]) but results in simpler, more readable code that resembles regular programming rather than complex template metaprogramming. The author demonstrates how value-based reflection eliminates the need for extensive template machinery and allows for both functional and imperative programming styles.

26m read timeFrom brevzin.github.io
Post cover image
Table of contents
The Reflection TSImplementing the Reflection TSA type-based implementationA value-based implementationComparing type-based to value-based

Sort: