lockfree hashmap minor modification (at instead of operator[])

This commit is contained in:
buda 2015-10-03 21:02:51 +02:00
parent 7e846b4dc0
commit ed3a82ee01
2 changed files with 5 additions and 4 deletions

View File

@ -10,9 +10,11 @@ namespace lockfree
{
template <class K, class V>
class HashMap: Lockable<SpinLock> {
class HashMap: Lockable<SpinLock>
{
public:
V operator[](const K& key)
V at(const K& key)
{
auto guard = acquire();

View File

@ -4,7 +4,6 @@
TEST_CASE("Lockfree HashMap basic functionality")
{
lockfree::HashMap<int, int> hashmap;
// hashmap[32] = 10;
hashmap.put(32, 10);
REQUIRE(hashmap[32] == 10);
REQUIRE(hashmap.at(32) == 10);
}