equality (1) |
template <class Key, class T, class Hash, class Pred, class Alloc> bool operator== ( const unordered_multimap<Key,T,Hash,Pred,Alloc>& lhs, const unordered_multimap<Key,T,Hash,Pred,Alloc>& rhs ); |
inequality (2) |
template <class Key, class T, class Hash, class Pred, class Alloc> bool operator!= ( const unordered_multimap<Key,T,Hash,Pred,Alloc>& lhs, const unordered_multimap<Key,T,Hash,Pred,Alloc>& rhs ); |
// unordered_multimap comparisons #include <iostream> #include <string> #include <unordered_map> typedef std::unordered_multimap<std::string,int> stringmap; int main () { stringmap a = { {"AAPL",100}, {"MSFT",200}, {"GOOG",50}, {"GOOG",20} }; stringmap b = { {"GOOG",20}, {"MSFT",200}, {"AAPL",100}, {"GOOG",50} }; stringmap c = { {"GOOG",70}, {"MSFT",200}, {"AAPL",100} }; if (a==b) std::cout << "a and b are equal\n"; if (b!=c) std::cout << "b and c are not equal\n"; return 0; } |
unordered_multimap::equal_range | 获取具有特定键的元素范围(公众成员函数) |
unordered_multimap::operator= | 复制容器内容(公众成员函数) |