You can use the nm program (part of binutils ) to view a list of characters used by your program. For instance:
$ g++ test.cc -o test $ nm test | grep GetMax 00002ef0 T __Z6GetMaxIiET_S0_S0_ 00002f5c T __Z6GetMaxIiET_S0_S0_.eh 00002f17 T __Z6GetMaxIlET_S0_S0_ 00002f80 T __Z6GetMaxIlET_S0_S0_.eh
I donβt know why each of them has two copies, one with the suffix .eh , but otherwise you can say that this particular function was created twice. If the nm version supports the -C/--demangle , you can use this to get readable names:
$ nm --demangle test | grep GetMax 00002ef0 T int GetMax<int>(int, int) 00002f5c T _Z6GetMaxIiET_S0_S0_.eh 00002f17 T long GetMax<long>(long, long) 00002f80 T _Z6GetMaxIlET_S0_S0_.eh
If this option is not supported, you can use c++filt to untie them:
$ nm test | grep GetMax | c++filt 00002ef0 T int GetMax<int>(int, int) 00002f5c T __Z6GetMaxIiET_S0_S0_.eh 00002f17 T long GetMax<long>(long, long) 00002f80 T __Z6GetMaxIlET_S0_S0_.eh
So you can see that GetMax was created using int and long respectively.
source share