tmp/tmpoylxhrqn/{from.md → to.md}
RENAMED
|
@@ -1,16 +1,16 @@
|
|
| 1 |
-
####
|
| 2 |
|
| 3 |
A *node handle* is an object that accepts ownership of a single element
|
| 4 |
-
from an associative container
|
| 5 |
-
associative container
|
| 6 |
ownership to another container with compatible nodes. Containers with
|
| 7 |
compatible nodes have the same node handle type. Elements may be
|
| 8 |
transferred in either direction between container types in the same row
|
| 9 |
-
of
|
| 10 |
|
| 11 |
-
**Table: Container types with compatible nodes** <a id="
|
| 12 |
|
| 13 |
| | |
|
| 14 |
| -------------------------------- | ------------------------------------- |
|
| 15 |
| `map<K, T, C1, A>` | `map<K, T, C2, A>` |
|
| 16 |
| `map<K, T, C1, A>` | `multimap<K, T, C2, A>` |
|
|
@@ -24,55 +24,58 @@ of Table [[tab:containers.node.compat]].
|
|
| 24 |
|
| 25 |
If a node handle is not empty, then it contains an allocator that is
|
| 26 |
equal to the allocator of the container when the element was extracted.
|
| 27 |
If a node handle is empty, it contains no allocator.
|
| 28 |
|
| 29 |
-
Class `
|
| 30 |
-
permitted to provide equivalent functionality without providing a class
|
| 31 |
-
with this name.
|
| 32 |
|
| 33 |
If a user-defined specialization of `pair` exists for
|
| 34 |
`pair<const Key, T>` or `pair<Key, T>`, where `Key` is the container’s
|
| 35 |
`key_type` and `T` is the container’s `mapped_type`, the behavior of
|
| 36 |
operations involving node handles is undefined.
|
| 37 |
|
| 38 |
``` cpp
|
| 39 |
template<unspecified>
|
| 40 |
-
|
| 41 |
public:
|
| 42 |
-
|
| 43 |
using value_type = see below; // not present for map containers
|
| 44 |
using key_type = see below; // not present for set containers
|
| 45 |
using mapped_type = see below; // not present for set containers
|
| 46 |
using allocator_type = see below;
|
| 47 |
|
| 48 |
private:
|
| 49 |
using container_node_type = unspecified;
|
| 50 |
using ator_traits = allocator_traits<allocator_type>;
|
| 51 |
|
| 52 |
-
|
| 53 |
optional<allocator_type> alloc_;
|
| 54 |
|
| 55 |
public:
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 61 |
value_type& value() const; // not present for map containers
|
| 62 |
key_type& key() const; // not present for set containers
|
| 63 |
mapped_type& mapped() const; // not present for set containers
|
| 64 |
|
| 65 |
allocator_type get_allocator() const;
|
| 66 |
explicit operator bool() const noexcept;
|
| 67 |
-
|
| 68 |
|
| 69 |
-
|
|
|
|
| 70 |
noexcept(ator_traits::propagate_on_container_swap::value ||
|
| 71 |
ator_traits::is_always_equal::value);
|
| 72 |
|
| 73 |
-
|
| 74 |
x.swap(y);
|
| 75 |
}
|
| 76 |
};
|
| 77 |
```
|
| 78 |
|
|
|
|
| 1 |
+
#### Overview <a id="container.node.overview">[[container.node.overview]]</a>
|
| 2 |
|
| 3 |
A *node handle* is an object that accepts ownership of a single element
|
| 4 |
+
from an associative container [[associative.reqmts]] or an unordered
|
| 5 |
+
associative container [[unord.req]]. It may be used to transfer that
|
| 6 |
ownership to another container with compatible nodes. Containers with
|
| 7 |
compatible nodes have the same node handle type. Elements may be
|
| 8 |
transferred in either direction between container types in the same row
|
| 9 |
+
of [[container.node.compat]].
|
| 10 |
|
| 11 |
+
**Table: Container types with compatible nodes** <a id="container.node.compat">[container.node.compat]</a>
|
| 12 |
|
| 13 |
| | |
|
| 14 |
| -------------------------------- | ------------------------------------- |
|
| 15 |
| `map<K, T, C1, A>` | `map<K, T, C2, A>` |
|
| 16 |
| `map<K, T, C1, A>` | `multimap<K, T, C2, A>` |
|
|
|
|
| 24 |
|
| 25 |
If a node handle is not empty, then it contains an allocator that is
|
| 26 |
equal to the allocator of the container when the element was extracted.
|
| 27 |
If a node handle is empty, it contains no allocator.
|
| 28 |
|
| 29 |
+
Class *`node-handle`* is for exposition only.
|
|
|
|
|
|
|
| 30 |
|
| 31 |
If a user-defined specialization of `pair` exists for
|
| 32 |
`pair<const Key, T>` or `pair<Key, T>`, where `Key` is the container’s
|
| 33 |
`key_type` and `T` is the container’s `mapped_type`, the behavior of
|
| 34 |
operations involving node handles is undefined.
|
| 35 |
|
| 36 |
``` cpp
|
| 37 |
template<unspecified>
|
| 38 |
+
class node-handle {
|
| 39 |
public:
|
| 40 |
+
// These type declarations are described in Tables [tab:container.assoc.req] and [tab:container.hash.req].
|
| 41 |
using value_type = see below; // not present for map containers
|
| 42 |
using key_type = see below; // not present for set containers
|
| 43 |
using mapped_type = see below; // not present for set containers
|
| 44 |
using allocator_type = see below;
|
| 45 |
|
| 46 |
private:
|
| 47 |
using container_node_type = unspecified;
|
| 48 |
using ator_traits = allocator_traits<allocator_type>;
|
| 49 |
|
| 50 |
+
typename ator_traits::template rebind_traits<container_node_type>::pointer ptr_;
|
| 51 |
optional<allocator_type> alloc_;
|
| 52 |
|
| 53 |
public:
|
| 54 |
+
// [container.node.cons], constructors, copy, and assignment
|
| 55 |
+
constexpr node-handle() noexcept : ptr_(), alloc_() {}
|
| 56 |
+
node-handle(node-handle&&) noexcept;
|
| 57 |
+
node-handle& operator=(node-handle&&);
|
| 58 |
|
| 59 |
+
// [container.node.dtor], destructor
|
| 60 |
+
~node-handle();
|
| 61 |
+
|
| 62 |
+
// [container.node.observers], observers
|
| 63 |
value_type& value() const; // not present for map containers
|
| 64 |
key_type& key() const; // not present for set containers
|
| 65 |
mapped_type& mapped() const; // not present for set containers
|
| 66 |
|
| 67 |
allocator_type get_allocator() const;
|
| 68 |
explicit operator bool() const noexcept;
|
| 69 |
+
[[nodiscard]] bool empty() const noexcept;
|
| 70 |
|
| 71 |
+
// [container.node.modifiers], modifiers
|
| 72 |
+
void swap(node-handle&)
|
| 73 |
noexcept(ator_traits::propagate_on_container_swap::value ||
|
| 74 |
ator_traits::is_always_equal::value);
|
| 75 |
|
| 76 |
+
friend void swap(node-handle& x, node-handle& y) noexcept(noexcept(x.swap(y))) {
|
| 77 |
x.swap(y);
|
| 78 |
}
|
| 79 |
};
|
| 80 |
```
|
| 81 |
|