From e58ba2e044331ab913ac28526e07aca7ee117aa4 Mon Sep 17 00:00:00 2001 From: Christian Mazakas Date: Fri, 11 Feb 2022 15:48:21 -0800 Subject: [PATCH] Add missing reference docs for member function template `insert` for unordered_map/multimap --- doc/unordered/unordered_map.adoc | 43 +++++++++++++++++++++++++++ doc/unordered/unordered_multimap.adoc | 42 ++++++++++++++++++++++++++ 2 files changed, 85 insertions(+) diff --git a/doc/unordered/unordered_map.adoc b/doc/unordered/unordered_map.adoc index 1e8f61c5..9d018990 100644 --- a/doc/unordered/unordered_map.adoc +++ b/doc/unordered/unordered_map.adoc @@ -120,12 +120,20 @@ public: std::pair insert(value_type&& obj); + template + std::pair + insert(P&& value); + insert_return_type insert(node_type&& nh); iterator insert(const_iterator hint, value_type const& obj); iterator insert(const_iterator hint, value_type&& obj); iterator insert(const_iterator hint, node_type&& nh); + template + std::pair + insert(const_iterator hint, P&& value); + template void insert(InputIterator first, InputIterator last); @@ -795,6 +803,21 @@ Notes:: Can invalidate iterators, but only if the insert causes the load factor --- +==== Emplace Insert +```c++ +template +std::pair +insert(P&& value); +``` + +Inserts an element into the container by performing `emplace(std::forward

(value))`. + +Only participates in overload resolution if `std::is_constructible::value` is `true`. + +Returns:: The bool component of the return type is true if an insert took place. If an insert took place, then the iterator points to the newly inserted element. Otherwise, it points to the element with equivalent key. + +--- + ==== Insert with `node_handle` ```c++ insert_return_type @@ -852,6 +875,26 @@ Notes:: The standard is fairly vague on the meaning of the hint. But the only pr --- +==== Emplace Insert with Hint + +```c++ +template +std::pair +insert(const_iterator hint, P&& value); +``` + +Inserts an element into the container by performing `emplace(std::forward

(value))`. + +Only participates in overload resolution if `std::is_constructible::value` is `true`. + +`hint` is a suggestion to where the element should be inserted. + +Returns:: The bool component of the return type is true if an insert took place. If an insert took place, then the iterator points to the newly inserted element. Otherwise, it points to the element with equivalent key. + +Notes:: The standard is fairly vague on the meaning of the hint. But the only practical way to use it, and the only way that Boost.Unordered supports is to point to an existing element with the same key. Can invalidate iterators, but only if the insert causes the load factor to be greater to or equal to the maximum load factor. Pointers and references to elements are never invalidated. + +--- + ==== Insert with Hint and `node_handle` ```c++ iterator insert(const_iterator hint, node_type&& nh); diff --git a/doc/unordered/unordered_multimap.adoc b/doc/unordered/unordered_multimap.adoc index 33ce8573..4abe6329 100644 --- a/doc/unordered/unordered_multimap.adoc +++ b/doc/unordered/unordered_multimap.adoc @@ -120,12 +120,20 @@ public: std::pair insert(value_type&& obj); + template + iterator + insert(P&& value); + insert_return_type insert(node_type&& nh); iterator insert(const_iterator hint, value_type const& obj); iterator insert(const_iterator hint, value_type&& obj); iterator insert(const_iterator hint, node_type&& nh); + template + iterator + insert(const_iterator hint, P&& value); + template void insert(InputIterator first, InputIterator last); @@ -787,6 +795,21 @@ Notes:: Can invalidate iterators, but only if the insert causes the load factor --- +==== Emplace Insert +```c++ +template +iterator +insert(P&& value); +``` + +Inserts an element into the container by performing `emplace(std::forward

(value))`. + +Only participates in overload resolution if `std::is_constructible::value` is `true`. + +Returns:: An iterator pointing to the inserted element. + +--- + ==== Insert with `node_handle` ```c++ insert_return_type @@ -844,6 +867,25 @@ Notes:: The standard is fairly vague on the meaning of the hint. But the only pr --- +==== Emplace Insert with Hint +```c++ +template +iterator +insert(P&& value); +``` + +Inserts an element into the container by performing `emplace(std::forward

(value))`. + +Only participates in overload resolution if `std::is_constructible::value` is `true`. + +`hint` is a suggestion to where the element should be inserted. + +Returns:: An iterator pointing to the inserted element. + +Notes:: The standard is fairly vague on the meaning of the hint. But the only practical way to use it, and the only way that Boost.Unordered supports is to point to an existing element with the same key. Can invalidate iterators, but only if the insert causes the load factor to be greater to or equal to the maximum load factor. Pointers and references to elements are never invalidated. + +--- + ==== Insert with Hint and `node_handle` ```c++ iterator insert(const_iterator hint, node_type&& nh);