mardi 14 avril 2020

error: Qualified name refers into a specialization of variable template

I am currently trying to make a Hash table template function and then adapt a password server class on top of it. I've run into a problem when trying to adapt the password server class to the hash table template. When I try to call a function from the template:

PassServer::PassServer(size_t size) : passwords(size)
{
    HashTable<std::string, std::string>::HashTable(size);
}

it keeps giving me an error "Qualified name refers into a specialization of variable template 'HashTable'" and I have no idea how to solve this. I've added a specialization for the constructor yet it doesn't seem to change anything. This is the constructor I'm trying to adapt:

template <typename K, typename V>
HashTable<K, V>::HashTable(size_t size = 101)
{
    theHash.resize(prime_below(size));
    currentSize = 0;
}

with the specialized constructor:

template<>
HashTable<std::string, std::string>::HashTable(size_t size = 101)
{
    theHash.resize(prime_below(size));
    currentSize = 0;
}

but it still gives the same error

Aucun commentaire:

Enregistrer un commentaire