Since the function is independent of the template parameter, the compiler can condense all instances into one function.
I do not know why you get 1 for the address.
Added by Nawaz :
I experimented with my real code and came to the conclusion that what @Mark said above is very important here:
Since the function is independent of the template parameter, the compiler can condense all instances into one function.
I also came to the conclusion that if the body function depends on T* , and not on T , it still produces the same function for different type arguments in my real code (but not on ideon). However, if it depends on T , then it creates different functions, because sizeof(T) is different (fortunately for me) for different type arguments.
So, I added a dummy automatic variable of type T to the function template so that the function could depend on the size of T to force it to create different functions.
Mark Ransom Feb 17 '12 at 5:20 2012-02-17 05:20
source share