|
1199 | 1199 |
|
1200 | 1200 | \rSec2[container.node]{Node handles}
|
1201 | 1201 |
|
1202 |
| -\rSec3[container.node.overview]{\tcode{node_handle} overview} |
| 1202 | +\rSec3[container.node.overview]{Overview} |
1203 | 1203 |
|
1204 | 1204 | \pnum
|
1205 |
| -A \term{node handle} is an object that accepts ownership of a single element |
| 1205 | +A \defn{node handle} is an object that accepts ownership of a single element |
1206 | 1206 | from an associative container\iref{associative.reqmts} or an unordered
|
1207 | 1207 | associative container\iref{unord.req}. It may be used to transfer that
|
1208 | 1208 | ownership to another container with compatible nodes. Containers with
|
|
1249 | 1249 |
|
1250 | 1250 | \begin{codeblock}
|
1251 | 1251 | template<@\unspecnc@>
|
1252 |
| - class @\placeholder{node_handle}@ { |
1253 |
| - public: |
1254 |
| - // These type declarations are described in Tables \ref{tab:containers.associative.requirements} and \ref{tab:HashRequirements}. |
1255 |
| - using value_type = @\seebelownc{}@; // not present for map containers |
1256 |
| - using key_type = @\seebelownc{}@; // not present for set containers |
1257 |
| - using mapped_type = @\seebelownc{}@; // not present for set containers |
1258 |
| - using allocator_type = @\seebelownc{}@; |
1259 |
| - |
1260 |
| - private: |
1261 |
| - using container_node_type = @\unspecnc@; |
1262 |
| - using ator_traits = allocator_traits<allocator_type>; |
1263 |
| - |
1264 |
| - typename ator_traits::rebind_traits<container_node_type>::pointer ptr_; |
1265 |
| - optional<allocator_type> alloc_; |
1266 |
| - |
1267 |
| - public: |
1268 |
| - constexpr @\placeholdernc{node_handle}@() noexcept : ptr_(), alloc_() {} |
1269 |
| - ~@\placeholdernc{node_handle}@(); |
1270 |
| - @\placeholdernc{node_handle}@(@\placeholdernc{node_handle}@&&) noexcept; |
1271 |
| - @\placeholdernc{node_handle}@& operator=(@\placeholdernc{node_handle}@&&); |
1272 |
| - |
1273 |
| - value_type& value() const; // not present for map containers |
1274 |
| - key_type& key() const; // not present for set containers |
1275 |
| - mapped_type& mapped() const; // not present for set containers |
1276 |
| - |
1277 |
| - allocator_type get_allocator() const; |
1278 |
| - explicit operator bool() const noexcept; |
1279 |
| - [[nodiscard]] bool empty() const noexcept; |
1280 |
| - |
1281 |
| - void swap(@\placeholdernc{node_handle}@&) |
1282 |
| - noexcept(ator_traits::propagate_on_container_swap::value || |
1283 |
| - ator_traits::is_always_equal::value); |
1284 |
| - |
1285 |
| - friend void swap(@\placeholdernc{node_handle}@& x, @\placeholdernc{node_handle}@& y) noexcept(noexcept(x.swap(y))) { |
1286 |
| - x.swap(y); |
1287 |
| - } |
| 1252 | +class @\placeholder{node_handle}@ { |
| 1253 | +public: |
| 1254 | + // These type declarations are described in Tables \ref{tab:containers.associative.requirements} and \ref{tab:HashRequirements}. |
| 1255 | + using value_type = @\seebelownc{}@; // not present for map containers |
| 1256 | + using key_type = @\seebelownc{}@; // not present for set containers |
| 1257 | + using mapped_type = @\seebelownc{}@; // not present for set containers |
| 1258 | + using allocator_type = @\seebelownc{}@; |
| 1259 | + |
| 1260 | +private: |
| 1261 | + using container_node_type = @\unspecnc@; |
| 1262 | + using ator_traits = allocator_traits<allocator_type>; |
| 1263 | + |
| 1264 | + typename ator_traits::rebind_traits<container_node_type>::pointer ptr_; |
| 1265 | + optional<allocator_type> alloc_; |
| 1266 | + |
| 1267 | +public: |
| 1268 | + // \ref{container.node.cons}, constructors, copy, and assignment |
| 1269 | + constexpr @\placeholdernc{node_handle}@() noexcept : ptr_(), alloc_() {} |
| 1270 | + @\placeholdernc{node_handle}@(@\placeholdernc{node_handle}@&&) noexcept; |
| 1271 | + @\placeholdernc{node_handle}@& operator=(@\placeholdernc{node_handle}@&&); |
| 1272 | + |
| 1273 | + // \ref{container.node.dtor}, destructor |
| 1274 | + ~@\placeholdernc{node_handle}@(); |
| 1275 | + |
| 1276 | + // \ref{container.node.observers}, observers |
| 1277 | + value_type& value() const; // not present for map containers |
| 1278 | + key_type& key() const; // not present for set containers |
| 1279 | + mapped_type& mapped() const; // not present for set containers |
| 1280 | + |
| 1281 | + allocator_type get_allocator() const; |
| 1282 | + explicit operator bool() const noexcept; |
| 1283 | + [[nodiscard]] bool empty() const noexcept; |
| 1284 | + |
| 1285 | + // \ref{container.node.modifiers}, modifiers |
| 1286 | + void swap(@\placeholdernc{node_handle}@&) |
| 1287 | + noexcept(ator_traits::propagate_on_container_swap::value || |
| 1288 | + ator_traits::is_always_equal::value); |
| 1289 | + |
| 1290 | + friend void swap(@\placeholdernc{node_handle}@& x, @\placeholdernc{node_handle}@& y) noexcept(noexcept(x.swap(y))) { |
| 1291 | + x.swap(y); |
| 1292 | + } |
1288 | 1293 | };
|
1289 | 1294 | \end{codeblock}
|
1290 | 1295 |
|
1291 |
| -\rSec3[container.node.cons]{\tcode{\placeholder{node_handle}} constructors, copy, and assignment} |
| 1296 | +\rSec3[container.node.cons]{Constructors, copy, and assignment} |
1292 | 1297 |
|
1293 | 1298 | \begin{itemdecl}
|
1294 | 1299 | @\placeholdernc{node_handle}@(@\placeholdernc{node_handle}@&& nh) noexcept;
|
|
1336 | 1341 | \pnum \throws Nothing.
|
1337 | 1342 | \end{itemdescr}
|
1338 | 1343 |
|
1339 |
| -\rSec3[container.node.dtor]{\tcode{\placeholder{node_handle}} destructor} |
| 1344 | +\rSec3[container.node.dtor]{Destructor} |
1340 | 1345 |
|
1341 | 1346 | \begin{itemdecl}
|
1342 | 1347 | ~@\placeholdernc{node_handle}@();
|
|
1350 | 1355 | \tcode{ator_traits::rebind_traits<container_node_type>::deallocate}.
|
1351 | 1356 | \end{itemdescr}
|
1352 | 1357 |
|
1353 |
| -\rSec3[container.node.observers]{\tcode{\placeholder{node_handle}} observers} |
| 1358 | +\rSec3[container.node.observers]{Observers} |
1354 | 1359 |
|
1355 | 1360 | \begin{itemdecl}
|
1356 | 1361 | value_type& value() const;
|
|
1439 | 1444 | \returns \tcode{ptr_ == nullptr}.
|
1440 | 1445 | \end{itemdescr}
|
1441 | 1446 |
|
1442 |
| -\rSec3[container.node.modifiers]{\tcode{\placeholder{node_handle}} modifiers} |
| 1447 | +\rSec3[container.node.modifiers]{Modifiers} |
1443 | 1448 |
|
1444 | 1449 | \begin{itemdecl}
|
1445 | 1450 | void swap(@\placeholdernc{node_handle}@& nh)
|
|
0 commit comments