I am trying to get a hash of various types of objects like strings and vectors.
The following code is fine ...
std::string data = std::string("abc");
std::cout << std::hash<std::string>()(data) << std::endl;
... but not this one, although I just replaced the string type with a vector type.
std::vector<int> data( {1,2,3} );
std::cout << std::hash<std::vector<int> >()(data) << std::endl;
g ++ -std = gnu + 11 says:
invalid use of incomplete type 'struct std::hash<std::vector<int> >'
... why?
source
share