Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

SF Bug 603

SF Bug #603 count() is missing in HashMap
https://sourceforge.net/p/poco/bugs/603/
  • Loading branch information...
commit 0c4d2590f75d93721adb7fab14be215adb6b230b 1 parent cdd17f5
Aleksandar Fabijanic aleks-f authored
6 Foundation/include/Poco/HashMap.h
View
@@ -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);
1  Foundation/testsuite/src/HashMapTest.cpp
View
@@ -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);
}
Please sign in to comment.
Something went wrong with that request. Please try again.