is there a way to know the compiler instantiated code for a template function or a class in C++
Assume I have the following piece of code
template &l
If you want to see the assembly output, use this:
g++ -S file.cpp
If you want to see some (pseudo) C++ code that GCC generates, you can use this:
g++ -fdump-tree-original file.cpp
For your add
function, this will output something like
;; Function T add(const T&, const T&) [with T = int] (null)
;; enabled by -tree-original
return = (int) *l + (int) *r;
(I passed the parameters by reference to make the output a little more interesting)