I am trying to implement C++ function using assembly code -- ARMv7-a, to be specific. Now I encounter a program that I don't know how C++ function template should be implemented in assembly. I try to compile the source code with -S -O1 flag to see the generated assembly but couldn't understand it. Can any one give me a brief idea how the C++ template is translated into assembly code? Just use the following simple function as an example:
template<typename T>
T f(T a) {
return a + 1;
}
If you found any other function is easier to do the explain, please do so. Thanks!