From Jason Turner

[container.node.overview]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpvrgdirjy/{from.md → to.md} +78 -0
tmp/tmpvrgdirjy/{from.md → to.md} RENAMED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #### `node_handle` 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 Table  [[tab:containers.node.compat]].
10
+
11
+ **Table: Container types with compatible nodes** <a id="tab:containers.node.compat">[tab:containers.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>` |
17
+ | `set<K, C1, A>` | `set<K, C2, A>` |
18
+ | `set<K, C1, A>` | `multiset<K, C2, A>` |
19
+ | `unordered_map<K, T, H1, E1, A>` | `unordered_map<K, T, H2, E2, A>` |
20
+ | `unordered_map<K, T, H1, E1, A>` | `unordered_multimap<K, T, H2, E2, A>` |
21
+ | `unordered_set<K, H1, E1, A>` | `unordered_set<K, H2, E2, A>` |
22
+ | `unordered_set<K, H1, E1, A>` | `unordered_multiset<K, H2, E2, A>` |
23
+
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. An implementation is
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
+ class node_handle {
41
+ public:
42
+ // These type declarations are described in Tables [tab:containers.associative.requirements] and [tab:HashRequirements].
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
+ typename ator_traits::rebind_traits<container_node_type>::pointer ptr_;
53
+ optional<allocator_type> alloc_;
54
+
55
+ public:
56
+ constexpr node_handle() noexcept : ptr_(), alloc_() {}
57
+ ~node_handle();
58
+ node_handle(node_handle&&) noexcept;
59
+ node_handle& operator=(node_handle&&);
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
+ bool empty() const noexcept;
68
+
69
+ void swap(node_handle&)
70
+ noexcept(ator_traits::propagate_on_container_swap::value ||
71
+ ator_traits::is_always_equal::value);
72
+
73
+ friend void swap(node_handle& x, node_handle& y) noexcept(noexcept(x.swap(y))) {
74
+ x.swap(y);
75
+ }
76
+ };
77
+ ```
78
+