How do I determine what my compiler (g++) is doing with template code?
I am using boost.proto (an expression-template library) to evaluate some maths expressions at compile time. The code evaluates the expressions correctly, but I would like to see whether the compiler has expanded out the expression to the equivalent of hand-written c-code (i.e. eliminated all the temporaries), or whether there is still some further compile-time optimizations to be done.
Is there a way to see what the compiler has done with the templates?
Thanks
There are several ways to see a C++ code after the templates instantiation pass:
gcc -fdump-tree-original
(or even -fdump-tree-all
to see more passes)