mirror of
https://github.com/pocoproject/poco.git
synced 2025-02-21 14:42:51 +01:00
SF Bug 603
SF Bug #603 count() is missing in HashMap https://sourceforge.net/p/poco/bugs/603/
This commit is contained in:
parent
cdd17f5203
commit
0c4d2590f7
@ -180,6 +180,12 @@ public:
|
||||
return _table.find(value);
|
||||
}
|
||||
|
||||
std::size_t count(const KeyType& key) const
|
||||
{
|
||||
ValueType value(key);
|
||||
return _table.find(value) != _table.end() ? 1 : 0;
|
||||
}
|
||||
|
||||
std::pair<Iterator, bool> insert(const PairType& pair)
|
||||
{
|
||||
ValueType value(pair.first, pair.second);
|
||||
|
@ -70,6 +70,7 @@ void HashMapTest::testInsert()
|
||||
assert (it != hm.end());
|
||||
assert (it->first == i);
|
||||
assert (it->second == i*2);
|
||||
assert (hm.count(i) == 1);
|
||||
assert (hm.size() == i + 1);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user