Commit 3f12b5ad authored by Yedidya Feldblum's avatar Yedidya Feldblum Committed by Facebook Github Bot

Fix incorrect copy constructions in ConcurrentHashMap

Summary: [Folly] Fix incorrect copy constructions in `ConcurrentHashMap`, where the `ConstIterator` is move-only but the code attempts to copy it.

Reviewed By: magedm

Differential Revision: D8678003

fbshipit-source-id: 89d47b811fb27ecbbd42cae03a2af13becd0082a
parent f7afb2cc
......@@ -278,15 +278,15 @@ class ConcurrentHashMap {
ConstIterator res(this, segment);
auto seg = segments_[segment].load(std::memory_order_acquire);
if (!seg) {
return folly::Optional<ConstIterator>();
return none;
} else {
auto r =
seg->assign(res.it_, std::forward<Key>(k), std::forward<Value>(v));
if (!r) {
return folly::Optional<ConstIterator>();
return none;
}
}
return res;
return std::move(res);
}
// Assign to desired if and only if key k is equal to expected
......@@ -297,7 +297,7 @@ class ConcurrentHashMap {
ConstIterator res(this, segment);
auto seg = segments_[segment].load(std::memory_order_acquire);
if (!seg) {
return folly::Optional<ConstIterator>();
return none;
} else {
auto r = seg->assign_if_equal(
res.it_,
......@@ -305,10 +305,10 @@ class ConcurrentHashMap {
expected,
std::forward<Value>(desired));
if (!r) {
return folly::Optional<ConstIterator>();
return none;
}
}
return res;
return std::move(res);
}
// Copying wrappers around insert and find.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment