C++ Unordered Map With Custom Class

409 views Asked by At

I'm trying to create a C++ unordered map that keys strings to one of my custom classes. i.e.:

name -> EmployeeInfo

I have used the following typedef to define the unordered map:

typedef std::unordered_map< std::string, class Employee > EmployeeStore;

But I am getting a compiler error:

error C2678: binary '==' : no operator found which takes a left-hand operand of type 'const std::string' (or there is no acceptable conversion)

Is this because the map template doesn't have a equivalency operator for type std::string? If so, can someone tell me where and how to write this. I just want a case-insensitive string key.

Thanks!

1

There are 1 answers

1
philhan On

I would bet you forgot to include the string header. That should define all the string operators.