]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
include/cpp-btree: drop node handle support
authorKefu Chai <kchai@redhat.com>
Sat, 12 Jun 2021 09:35:07 +0000 (17:35 +0800)
committerKefu Chai <kchai@redhat.com>
Fri, 18 Jun 2021 01:13:12 +0000 (09:13 +0800)
this is a leftover in 73f2d70fc8bdbb4a963483ded0487dd744def215,

the node support is useful if we want to move a node around in a
node-based container. but in the case of b-tree, multiple elements
are packed into a single node/block, so we cannot benefit from this
feature, i think. so just drop all of them.

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/include/cpp-btree/btree_container.h
src/include/cpp-btree/btree_set.h

index bcbd1ff4511da5948efecc93a994b94b32f0cc86..e8d9efd38a8e050fe2c1816256a7ca5258fafacd 100644 (file)
@@ -418,7 +418,6 @@ class btree_multiset_container : public btree_container<Tree> {
   using allocator_type = typename Tree::allocator_type;
   using iterator = typename Tree::iterator;
   using const_iterator = typename Tree::const_iterator;
-  using node_type = typename super_type::node_type;
 
   // Inherit constructors.
   using super_type::super_type;
@@ -472,22 +471,6 @@ class btree_multiset_container : public btree_container<Tree> {
     return this->tree_.insert_hint_multi(
         iterator(position), init_type(std::forward<Args>(args)...));
   }
-  iterator insert(node_type &&node) {
-    if (!node) return this->end();
-    iterator res =
-        this->tree_.insert_multi(params_type::key(node.slot()),
-                                 node.slot());
-    node.destroy();
-    return res;
-  }
-  iterator insert(const_iterator hint, node_type &&node) {
-    if (!node) return this->end();
-    iterator res = this->tree_.insert_hint_multi(
-        iterator(hint),
-        std::move(params_type::element(node.slot())));
-    node.destroy();
-    return res;
-  }
 
   // Deletion routines.
   template <typename K = key_type>
index 7d59887dc8828d08969f627b05c6359a55120377..57536ce2f502d67aad7d037cc52e843edbb4e20f 100644 (file)
@@ -532,29 +532,6 @@ class btree_multiset
   // Any references, pointers, or iterators are invalidated.
   using Base::emplace_hint;
 
-  // btree_multiset::extract()
-  //
-  // Extracts the indicated element, erasing it in the process, and returns it
-  // as a C++17-compatible node handle. Overloads are listed below.
-  //
-  // node_type extract(const_iterator position):
-  //
-  //   Extracts the element at the indicated position and returns a node handle
-  //   owning that extracted data.
-  //
-  // template <typename K> node_type extract(const K& x):
-  //
-  //   Extracts the element with the key matching the passed key value and
-  //   returns a node handle owning that extracted data. If the `btree_multiset`
-  //   does not contain an element with a matching key, this function returns an
-  //   empty node handle.
-  //
-  // NOTE: In this context, `node_type` refers to the C++17 concept of a
-  // move-only type that owns and provides access to the elements in associative
-  // containers (https://en.cppreference.com/w/cpp/container/node_handle).
-  // It does NOT refer to the data layout of the underlying btree.
-  using Base::extract;
-
   // btree_multiset::merge()
   //
   // Extracts elements from a given `source` btree_multiset into this