-
Notifications
You must be signed in to change notification settings - Fork 14.6k
[libc++] Fix insert() calling incorrect constructors #146231
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -520,7 +520,7 @@ public: | |
_LIBCPP_HIDE_FROM_ABI const_iterator end() const { return __table_.end(); } | ||
|
||
_LIBCPP_HIDE_FROM_ABI std::pair<iterator, bool> insert(const value_type& __x) { | ||
return __table_.__insert_unique(__x); | ||
return __table_.__emplace_unique(__x); | ||
} | ||
_LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator, const value_type& __x) { return insert(__x).first; } | ||
template <class _InputIterator> | ||
|
@@ -625,7 +625,7 @@ template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> | |
template <class _InputIterator> | ||
inline void hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::insert(_InputIterator __first, _InputIterator __last) { | ||
for (; __first != __last; ++__first) | ||
__table_.__insert_unique(*__first); | ||
__table_.__emplace_unique(*__first); | ||
} | ||
|
||
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> | ||
|
@@ -744,7 +744,7 @@ public: | |
_LIBCPP_HIDE_FROM_ABI const_iterator begin() const { return __table_.begin(); } | ||
_LIBCPP_HIDE_FROM_ABI const_iterator end() const { return __table_.end(); } | ||
|
||
_LIBCPP_HIDE_FROM_ABI iterator insert(const value_type& __x) { return __table_.__insert_multi(__x); } | ||
_LIBCPP_HIDE_FROM_ABI iterator insert(const value_type& __x) { return __table_.__emplace_unique(__x); } | ||
_LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator, const value_type& __x) { return insert(__x); } | ||
template <class _InputIterator> | ||
_LIBCPP_HIDE_FROM_ABI void insert(_InputIterator __first, _InputIterator __last); | ||
|
@@ -831,7 +831,7 @@ template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> | |
template <class _InputIterator> | ||
inline void hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::insert(_InputIterator __first, _InputIterator __last) { | ||
for (; __first != __last; ++__first) | ||
__table_.__insert_multi(*__first); | ||
__table_.__emplace_unique(*__first); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Likewise. |
||
} | ||
|
||
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -279,7 +279,7 @@ public: | |
_LIBCPP_HIDE_FROM_ABI const_iterator end() const { return __table_.end(); } | ||
|
||
_LIBCPP_HIDE_FROM_ABI std::pair<iterator, bool> insert(const value_type& __x) { | ||
return __table_.__insert_unique(__x); | ||
return __table_.__emplace_unique(__x); | ||
} | ||
_LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator, const value_type& __x) { return insert(__x).first; } | ||
template <class _InputIterator> | ||
|
@@ -365,7 +365,7 @@ template <class _Value, class _Hash, class _Pred, class _Alloc> | |
template <class _InputIterator> | ||
inline void hash_set<_Value, _Hash, _Pred, _Alloc>::insert(_InputIterator __first, _InputIterator __last) { | ||
for (; __first != __last; ++__first) | ||
__table_.__insert_unique(*__first); | ||
__table_.__emplace_unique(*__first); | ||
} | ||
|
||
template <class _Value, class _Hash, class _Pred, class _Alloc> | ||
|
@@ -458,7 +458,7 @@ public: | |
_LIBCPP_HIDE_FROM_ABI const_iterator begin() const { return __table_.begin(); } | ||
_LIBCPP_HIDE_FROM_ABI const_iterator end() const { return __table_.end(); } | ||
|
||
_LIBCPP_HIDE_FROM_ABI iterator insert(const value_type& __x) { return __table_.__insert_multi(__x); } | ||
_LIBCPP_HIDE_FROM_ABI iterator insert(const value_type& __x) { return __table_.__emplace_unique(__x); } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Likewise. |
||
_LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator, const value_type& __x) { return insert(__x); } | ||
template <class _InputIterator> | ||
_LIBCPP_HIDE_FROM_ABI void insert(_InputIterator __first, _InputIterator __last); | ||
|
@@ -543,7 +543,7 @@ template <class _Value, class _Hash, class _Pred, class _Alloc> | |
template <class _InputIterator> | ||
inline void hash_multiset<_Value, _Hash, _Pred, _Alloc>::insert(_InputIterator __first, _InputIterator __last) { | ||
for (; __first != __last; ++__first) | ||
__table_.__insert_multi(*__first); | ||
__table_.__emplace_unique(*__first); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Likewise. |
||
} | ||
|
||
template <class _Value, class _Hash, class _Pred, class _Alloc> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be
emplace_multi
notemplace_unique
?