I am working on an assignment for my C ++ programming class, which includes a hash map implementation. My instructor gave us a header file that we should use with our hash class. The provided header file contains the line:
typedef std::function<unsigned int(const std::string&)> HashFunction;
From my (limited) understanding of C ++, this will define the HashFunction type as std :: function. However, when I compile the code, I get errors:
./HashMap.h:46:15: error: no type named 'function' in namespace 'std' typedef std::function<unsigned int(const std::string&)> HashFunction; ~~~~~^ ./HashMap.h:46:23: error: expected member name or ';' after declaration specifiers typedef std::function<unsigned int(const std::string&)> HashFunction; ~~~~~~~~~~~~~~~~~~~~~^
There is a HashMap.h file
#include <functional>
above if that matters.
Does anyone know why I am getting these errors?
source share