mirror of
https://github.com/greg7mdp/parallel-hashmap.git
synced 2026-08-30 00:50:38 +08:00
Add tests for btree and fix a couple issues.
This commit is contained in:
Vendored
+19
-7
@@ -2874,6 +2874,18 @@ public:
|
||||
protected:
|
||||
friend struct CommonAccess;
|
||||
|
||||
struct transfer_tag_t {};
|
||||
node_handle_base(transfer_tag_t, const allocator_type& a, slot_type* s)
|
||||
: alloc_(a) {
|
||||
PolicyTraits::transfer(alloc(), slot(), s);
|
||||
}
|
||||
|
||||
struct move_tag_t {};
|
||||
node_handle_base(move_tag_t, const allocator_type& a, slot_type* s)
|
||||
: alloc_(a) {
|
||||
PolicyTraits::construct(alloc(), slot(), s);
|
||||
}
|
||||
|
||||
node_handle_base(const allocator_type& a, slot_type* s) : alloc_(a) {
|
||||
PolicyTraits::transfer(alloc(), slot(), s);
|
||||
}
|
||||
@@ -2923,7 +2935,7 @@ public:
|
||||
private:
|
||||
friend struct CommonAccess;
|
||||
|
||||
node_handle(const Alloc& a, typename Base::slot_type* s) : Base(a, s) {}
|
||||
using Base::Base;
|
||||
};
|
||||
|
||||
// For maps.
|
||||
@@ -2952,7 +2964,7 @@ public:
|
||||
private:
|
||||
friend struct CommonAccess;
|
||||
|
||||
node_handle(const Alloc& a, typename Base::slot_type* s) : Base(a, s) {}
|
||||
using Base::Base;
|
||||
};
|
||||
|
||||
// Provide access to non-public node-handle functions.
|
||||
@@ -2963,6 +2975,11 @@ struct CommonAccess
|
||||
return node.slot();
|
||||
}
|
||||
|
||||
template <typename Node>
|
||||
static void Destroy(Node* node) {
|
||||
node->destroy();
|
||||
}
|
||||
|
||||
template <typename Node>
|
||||
static void Reset(Node* node) {
|
||||
node->reset();
|
||||
@@ -2973,11 +2990,6 @@ struct CommonAccess
|
||||
return T(std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
template <typename Node>
|
||||
static void Destroy(Node* node) {
|
||||
node->destroy();
|
||||
}
|
||||
|
||||
template <typename T, typename... Args>
|
||||
static T Transfer(Args&&... args) {
|
||||
return T(typename T::transfer_tag_t{}, std::forward<Args>(args)...);
|
||||
|
||||
Reference in New Issue
Block a user