lundi 2 novembre 2015

How to convert a Template class to an Int

I'm creating a Hash table for a homework assign, and i run trough a problem, i have a Template Structure with the key and data type

template<typename T, typename K>
struct Item
{
    T data;
    K key;
    state flag;
    Item() {}
    Item(T d, K k, state f) { data = d; key = k; flag = f; }
};

I need to convert the key (type K) to an int, how should i do?

Aucun commentaire:

Enregistrer un commentaire