dimanche 19 avril 2015

How to get the template type from a typedef

My goal is to automatically replace ???? with INT16 without passing INT16 as a template parameter:



#include <windows.h>

typedef Address<INT16> Address2Bytes;
// Address is a class made by me with constructor Address<Data>(const char*, const Data&)

template <typename Addr>
void doStuff(const char* addressName, const ????& addressData)
{
Addr address(addressName, addressData);// This variable MUST be created here

// Do stuff
}

void main(void)
{
doStuff<Address2Bytes>("name", 0x0);// Can't pass INT16 as a template (please don't ask why)
}

Aucun commentaire:

Enregistrer un commentaire