lockfree hashmap minor modification (at instead of operator[])
This commit is contained in:
parent
7e846b4dc0
commit
ed3a82ee01
@ -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();
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user