Skip to content

Commit

Permalink
SF Bug 603
Browse files Browse the repository at this point in the history
SF Bug #603 count() is missing in HashMap
https://sourceforge.net/p/poco/bugs/603/
  • Loading branch information
aleks-f committed Dec 3, 2012
1 parent d391de9 commit f5cbb34
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Foundation/include/Poco/HashMap.h
Expand Up @@ -180,6 +180,12 @@ class HashMap
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);
Expand Down
1 change: 1 addition & 0 deletions Foundation/testsuite/src/HashMapTest.cpp
Expand Up @@ -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);
}

Expand Down

0 comments on commit f5cbb34

Please sign in to comment.