Add tests for btree and fix a couple issues.

This commit is contained in:
greg
2019-12-30 13:42:48 -05:00
parent 3c5aba629c
commit 48144bc7f8
6 changed files with 2886 additions and 16 deletions
+19 -7
View File
@@ -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)...);