Practical Template Meta Programming (Part-1)

Static reflection using Template Meta Programming and Macros

In this blog we will implement a generic Print(user defined struct) utility function capable of printing all the public members of any user defined POD struct. For example: // We would like to Print MessageA // which has messageB as member item struct messageA { int a; messageB b; }; // messageB has messageD as member struct messageB { int p; messageD d[3]; }; // struct layout struct messageD { double t; int v; }; and we expect the output as shown below after executing the following program: [Read More]