Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
是否可以不为哈希生成和密钥比较声明另一个对象,而是在密钥类中为此功能创建成员函数?
如评论中所述,您可以轻松地operator==为您的班级定义一个。您还可以编写一个自由函数,该函数hash_value采用您的类的参数,并且应该自动使用它。
operator==
hash_value