[libcxx-commits] [libcxx] [libc++] Avoid type-punning between __value_type and pair (PR #134819)
Nikolas Klauser via libcxx-commits
libcxx-commits at lists.llvm.org
Thu May 8 00:18:56 PDT 2025
================
@@ -1135,6 +1126,17 @@ public:
return __emplace_hint_multi(__p, std::forward<_Vp>(__v));
}
+ template <class _ValueT = _Tp, __enable_if_t<__is_tree_value_type<_ValueT>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI void __insert_from_orphaned_node(const_iterator __p, __get_node_value_type_t<_Tp>&& __value) {
+ using __key_type = typename _NodeTypes::key_type;
+ __emplace_hint_multi(__p, const_cast<__key_type&&>(__value.first), std::move(__value.second));
+ }
+
+ template <class _ValueT = _Tp, __enable_if_t<!__is_tree_value_type<_ValueT>::value, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI void __insert_from_orphaned_node(const_iterator __p, _Tp&& __value) {
+ __emplace_hint_multi(__p, std::move(__value));
+ }
----------------
philnik777 wrote:
This is now used in `map` as well to avoid a `reinterpret_cast` there.
https://github.com/llvm/llvm-project/pull/134819
More information about the libcxx-commits
mailing list