diff options
Diffstat (limited to 'libstdc++-v3/include/bits/stl_map.h')
-rw-r--r-- | libstdc++-v3/include/bits/stl_map.h | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/libstdc++-v3/include/bits/stl_map.h b/libstdc++-v3/include/bits/stl_map.h index 0e8a98a96c1..bad6020ef47 100644 --- a/libstdc++-v3/include/bits/stl_map.h +++ b/libstdc++-v3/include/bits/stl_map.h @@ -778,7 +778,6 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER /** * @brief Attempts to insert a std::pair into the %map. - * @param __x Pair to be inserted (see std::make_pair for easy * creation of pairs). * @@ -791,12 +790,19 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER * first element (the key) is not already present in the %map. * * Insertion requires logarithmic time. + * @{ */ std::pair<iterator, bool> insert(const value_type& __x) { return _M_t._M_insert_unique(__x); } #if __cplusplus >= 201103L + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 2354. Unnecessary copying when inserting into maps with braced-init + std::pair<iterator, bool> + insert(value_type&& __x) + { return _M_t._M_insert_unique(std::move(__x)); } + template<typename _Pair, typename = typename std::enable_if<std::is_constructible<value_type, _Pair&&>::value>::type> @@ -804,6 +810,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER insert(_Pair&& __x) { return _M_t._M_insert_unique(std::forward<_Pair>(__x)); } #endif + // @} #if __cplusplus >= 201103L /** @@ -840,6 +847,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER * for more on @a hinting. * * Insertion requires logarithmic time (if the hint is not taken). + * @{ */ iterator #if __cplusplus >= 201103L @@ -850,6 +858,12 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER { return _M_t._M_insert_unique_(__position, __x); } #if __cplusplus >= 201103L + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 2354. Unnecessary copying when inserting into maps with braced-init + iterator + insert(const_iterator __position, value_type&& __x) + { return _M_t._M_insert_unique_(__position, std::move(__x)); } + template<typename _Pair, typename = typename std::enable_if<std::is_constructible<value_type, _Pair&&>::value>::type> @@ -858,6 +872,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER { return _M_t._M_insert_unique_(__position, std::forward<_Pair>(__x)); } #endif + // @} /** * @brief Template function that attempts to insert a range of elements. |