I'm experiencing some strange occurrences regarding varidaic templates that I never saw before. In order to keep it simple i'll give a simple example of what I was trying to achieve, the real code is a bit more involved.
So I have one function that looks like:
template <typename T, typename F, typename ... Args>
static T Func( std::string str, Args&& ... args )
{
... Do something
}
I then call this function a number of times from different locations, where most times the passed types are different. But when I debug this, when I look for the symbol of Func, I get that the same function address has a number of different symbols:
00000000`70ba4ae0 Func<unsigned long,unsigned long (__stdcall*)(wchar_t const *),wchar_t const *>
00000000`70ba4ae0 Func<void *,void * (__stdcall*)(unsigned int),unsigned int>
00000000`70ba4ae0 Func<int,int (__stdcall*)(void *),void *>
So they are all basically the same function. When I try to call for example:
call Func<void *,void * (__stdcall*)(unsigned int),unsigned int>
In the debugger I see:
call Func<int,int (__stdcall*)(void *),void *>
I can see that there is a generated symbol for every template specialization, but every such specialization that has the same number of arguments and the arguments are the same byte-size are just linked to one function.
While I can understand why this may happen, but is there a way to force each function to be standalone?
Aucun commentaire:
Enregistrer un commentaire