Skip to content

Commit f1fabdc

Browse files
use __node_traits::construct over placement new, copy_assing copy_alloc still pass
1 parent cca780a commit f1fabdc

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

libcxx/include/__tree

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -912,10 +912,10 @@ private:
912912
public:
913913
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __node_pointer __root() const _NOEXCEPT {
914914
// double t = __end_node()->__left_;
915-
using __ptr_traits = pointer_traits<__node_pointer>;
916-
using __element_type = typename __ptr_traits::element_type;
917-
typename __element_type_type x{};
918-
double t = x;
915+
// using __ptr_traits = pointer_traits<__node_pointer>;
916+
// using __element_type = typename __ptr_traits::element_type;
917+
// typename __element_type_type x{};
918+
// double t = x;
919919
return std::__static_fancy_pointer_cast<__node_pointer>(__end_node()->__left_);
920920
// return static_cast<__node_pointer>(__end_node()->__left_);
921921
}
@@ -1072,12 +1072,14 @@ typename __element_type_type x{};
10721072
__insert_unique_from_orphaned_node(const_iterator __p, __get_node_value_type_t<_Tp>&& __value) {
10731073
// fails here for move_alloc.pass.cpp
10741074
if (__libcpp_is_constant_evaluated()) {
1075-
// __node_allocator& __na = __value.__node_alloc();
1075+
__node_allocator& __na = __value.__node_alloc();
10761076
// __node_traits::destroy(__na, std::addressof(__lhs));
10771077
// __node_traits::construct(__na, std::addressof(__lhs), std::move(__tmp));
10781078
key_type __kk;
1079-
new (std::addressof(__kk))(key_type)(__value.first);
1080-
// __node_traits::construct(__na, std::addressof(__kk), std::move(__value.first));
1079+
// new (std::addressof(__kk))(key_type)(__value.first);
1080+
__node_traits::construct(__na, std::addressof(__kk), std::move(__value.first));
1081+
// __node_holder __h = __construct_node(std::forward<_Args>(__args)...);?
1082+
// __node_holder __h = __construct_node(__value);?
10811083
__emplace_hint_unique(__p, std::move(__kk), std::move(__value.second));
10821084
} else {
10831085
__emplace_hint_unique(__p, const_cast<key_type&&>(__value.first), std::move(__value.second));

0 commit comments

Comments
 (0)