diff --git a/libcxx/include/__bit_reference b/libcxx/include/__bit_reference --- a/libcxx/include/__bit_reference +++ b/libcxx/include/__bit_reference @@ -239,8 +239,8 @@ find(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last, const _Tp& __value_) { if (static_cast(__value_)) - return __find_bool_true(__first, static_cast(__last - __first)); - return __find_bool_false(__first, static_cast(__last - __first)); + return _VSTD::__find_bool_true(__first, static_cast(__last - __first)); + return _VSTD::__find_bool_false(__first, static_cast(__last - __first)); } // count @@ -313,8 +313,8 @@ count(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last, const _Tp& __value_) { if (static_cast(__value_)) - return __count_bool_true(__first, static_cast(__last - __first)); - return __count_bool_false(__first, static_cast(__last - __first)); + return _VSTD::__count_bool_true(__first, static_cast(__last - __first)); + return _VSTD::__count_bool_false(__first, static_cast(__last - __first)); } // fill_n @@ -387,9 +387,9 @@ if (__n > 0) { if (__value_) - __fill_n_true(__first, __n); + _VSTD::__fill_n_true(__first, __n); else - __fill_n_false(__first, __n); + _VSTD::__fill_n_false(__first, __n); } } @@ -538,8 +538,8 @@ copy(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last, __bit_iterator<_Cp, false> __result) { if (__first.__ctz_ == __result.__ctz_) - return __copy_aligned(__first, __last, __result); - return __copy_unaligned(__first, __last, __result); + return _VSTD::__copy_aligned(__first, __last, __result); + return _VSTD::__copy_unaligned(__first, __last, __result); } // copy_backward @@ -685,8 +685,8 @@ copy_backward(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last, __bit_iterator<_Cp, false> __result) { if (__last.__ctz_ == __result.__ctz_) - return __copy_backward_aligned(__first, __last, __result); - return __copy_backward_unaligned(__first, __last, __result); + return _VSTD::__copy_backward_aligned(__first, __last, __result); + return _VSTD::__copy_backward_unaligned(__first, __last, __result); } // move @@ -868,8 +868,8 @@ __bit_iterator<__C2, false> __first2) { if (__first1.__ctz_ == __first2.__ctz_) - return __swap_ranges_aligned(__first1, __last1, __first2); - return __swap_ranges_unaligned(__first1, __last1, __first2); + return _VSTD::__swap_ranges_aligned(__first1, __last1, __first2); + return _VSTD::__swap_ranges_unaligned(__first1, __last1, __first2); } // rotate @@ -1083,8 +1083,8 @@ equal(__bit_iterator<_Cp, _IC1> __first1, __bit_iterator<_Cp, _IC1> __last1, __bit_iterator<_Cp, _IC2> __first2) { if (__first1.__ctz_ == __first2.__ctz_) - return __equal_aligned(__first1, __last1, __first2); - return __equal_unaligned(__first1, __last1, __first2); + return _VSTD::__equal_aligned(__first1, __last1, __first2); + return _VSTD::__equal_unaligned(__first1, __last1, __first2); } template ; - __ns_rep __now_count_ns = __safe_nanosecond_cast(__c_now.time_since_epoch()).count(); + __ns_rep __now_count_ns = _VSTD::__safe_nanosecond_cast(__c_now.time_since_epoch()).count(); #else using __clock_tp_ns = time_point; - __ns_rep __now_count_ns = __safe_nanosecond_cast(system_clock::now().time_since_epoch()).count(); + __ns_rep __now_count_ns = _VSTD::__safe_nanosecond_cast(system_clock::now().time_since_epoch()).count(); #endif - __ns_rep __d_ns_count = __safe_nanosecond_cast(__d).count(); + __ns_rep __d_ns_count = _VSTD::__safe_nanosecond_cast(__d).count(); if (__now_count_ns > numeric_limits<__ns_rep>::max() - __d_ns_count) { __do_timed_wait(__lk, __clock_tp_ns::max()); diff --git a/libcxx/include/__tree b/libcxx/include/__tree --- a/libcxx/include/__tree +++ b/libcxx/include/__tree @@ -108,10 +108,10 @@ if (__x->__right_ && !__x->__right_->__is_black_) return 0; } - unsigned __h = __tree_sub_invariant(__x->__left_); + unsigned __h = _VSTD::__tree_sub_invariant(__x->__left_); if (__h == 0) return 0; // invalid left subtree - if (__h != __tree_sub_invariant(__x->__right_)) + if (__h != _VSTD::__tree_sub_invariant(__x->__right_)) return 0; // invalid or different height right subtree return __h + __x->__is_black_; // return black height of this node } @@ -128,13 +128,13 @@ // check __x->__parent_ consistency if (__root->__parent_ == nullptr) return false; - if (!__tree_is_left_child(__root)) + if (!_VSTD::__tree_is_left_child(__root)) return false; // root must be black if (!__root->__is_black_) return false; // do normal node checks - return __tree_sub_invariant(__root) != 0; + return _VSTD::__tree_sub_invariant(__root) != 0; } // Returns: pointer to the left-most node under __x. @@ -168,8 +168,8 @@ __tree_next(_NodePtr __x) _NOEXCEPT { if (__x->__right_ != nullptr) - return __tree_min(__x->__right_); - while (!__tree_is_left_child(__x)) + return _VSTD::__tree_min(__x->__right_); + while (!_VSTD::__tree_is_left_child(__x)) __x = __x->__parent_unsafe(); return __x->__parent_unsafe(); } @@ -180,8 +180,8 @@ __tree_next_iter(_NodePtr __x) _NOEXCEPT { if (__x->__right_ != nullptr) - return static_cast<_EndNodePtr>(__tree_min(__x->__right_)); - while (!__tree_is_left_child(__x)) + return static_cast<_EndNodePtr>(_VSTD::__tree_min(__x->__right_)); + while (!_VSTD::__tree_is_left_child(__x)) __x = __x->__parent_unsafe(); return static_cast<_EndNodePtr>(__x->__parent_); } @@ -195,9 +195,9 @@ __tree_prev_iter(_EndNodePtr __x) _NOEXCEPT { if (__x->__left_ != nullptr) - return __tree_max(__x->__left_); + return _VSTD::__tree_max(__x->__left_); _NodePtr __xx = static_cast<_NodePtr>(__x); - while (__tree_is_left_child(__xx)) + while (_VSTD::__tree_is_left_child(__xx)) __xx = __xx->__parent_unsafe(); return __xx->__parent_unsafe(); } @@ -237,7 +237,7 @@ if (__x->__right_ != nullptr) __x->__right_->__set_parent(__x); __y->__parent_ = __x->__parent_; - if (__tree_is_left_child(__x)) + if (_VSTD::__tree_is_left_child(__x)) __x->__parent_->__left_ = __y; else __x->__parent_unsafe()->__right_ = __y; @@ -257,7 +257,7 @@ if (__x->__left_ != nullptr) __x->__left_->__set_parent(__x); __y->__parent_ = __x->__parent_; - if (__tree_is_left_child(__x)) + if (_VSTD::__tree_is_left_child(__x)) __x->__parent_->__left_ = __y; else __x->__parent_unsafe()->__right_ = __y; @@ -281,7 +281,7 @@ while (__x != __root && !__x->__parent_unsafe()->__is_black_) { // __x->__parent_ != __root because __x->__parent_->__is_black == false - if (__tree_is_left_child(__x->__parent_unsafe())) + if (_VSTD::__tree_is_left_child(__x->__parent_unsafe())) { _NodePtr __y = __x->__parent_unsafe()->__parent_unsafe()->__right_; if (__y != nullptr && !__y->__is_black_) @@ -294,16 +294,16 @@ } else { - if (!__tree_is_left_child(__x)) + if (!_VSTD::__tree_is_left_child(__x)) { __x = __x->__parent_unsafe(); - __tree_left_rotate(__x); + _VSTD::__tree_left_rotate(__x); } __x = __x->__parent_unsafe(); __x->__is_black_ = true; __x = __x->__parent_unsafe(); __x->__is_black_ = false; - __tree_right_rotate(__x); + _VSTD::__tree_right_rotate(__x); break; } } @@ -320,16 +320,16 @@ } else { - if (__tree_is_left_child(__x)) + if (_VSTD::__tree_is_left_child(__x)) { __x = __x->__parent_unsafe(); - __tree_right_rotate(__x); + _VSTD::__tree_right_rotate(__x); } __x = __x->__parent_unsafe(); __x->__is_black_ = true; __x = __x->__parent_unsafe(); __x->__is_black_ = false; - __tree_left_rotate(__x); + _VSTD::__tree_left_rotate(__x); break; } } @@ -352,7 +352,7 @@ // __y will have at most one child. // __y will be the initial hole in the tree (make the hole at a leaf) _NodePtr __y = (__z->__left_ == nullptr || __z->__right_ == nullptr) ? - __z : __tree_next(__z); + __z : _VSTD::__tree_next(__z); // __x is __y's possibly null single child _NodePtr __x = __y->__left_ != nullptr ? __y->__left_ : __y->__right_; // __w is __x's possibly null uncle (will become __x's sibling) @@ -360,7 +360,7 @@ // link __x to __y's parent, and find __w if (__x != nullptr) __x->__parent_ = __y->__parent_; - if (__tree_is_left_child(__y)) + if (_VSTD::__tree_is_left_child(__y)) { __y->__parent_->__left_ = __x; if (__y != __root) @@ -381,7 +381,7 @@ { // __z->__left_ != nulptr but __z->__right_ might == __x == nullptr __y->__parent_ = __z->__parent_; - if (__tree_is_left_child(__z)) + if (_VSTD::__tree_is_left_child(__z)) __y->__parent_->__left_ = __y; else __y->__parent_unsafe()->__right_ = __y; @@ -421,13 +421,13 @@ // with a non-null black child). while (true) { - if (!__tree_is_left_child(__w)) // if x is left child + if (!_VSTD::__tree_is_left_child(__w)) // if x is left child { if (!__w->__is_black_) { __w->__is_black_ = true; __w->__parent_unsafe()->__is_black_ = false; - __tree_left_rotate(__w->__parent_unsafe()); + _VSTD::__tree_left_rotate(__w->__parent_unsafe()); // __x is still valid // reset __root only if necessary if (__root == __w->__left_) @@ -448,7 +448,7 @@ break; } // reset sibling, and it still can't be null - __w = __tree_is_left_child(__x) ? + __w = _VSTD::__tree_is_left_child(__x) ? __x->__parent_unsafe()->__right_ : __x->__parent_->__left_; // continue; @@ -460,7 +460,7 @@ // __w left child is non-null and red __w->__left_->__is_black_ = true; __w->__is_black_ = false; - __tree_right_rotate(__w); + _VSTD::__tree_right_rotate(__w); // __w is known not to be root, so root hasn't changed // reset sibling, and it still can't be null __w = __w->__parent_unsafe(); @@ -469,7 +469,7 @@ __w->__is_black_ = __w->__parent_unsafe()->__is_black_; __w->__parent_unsafe()->__is_black_ = true; __w->__right_->__is_black_ = true; - __tree_left_rotate(__w->__parent_unsafe()); + _VSTD::__tree_left_rotate(__w->__parent_unsafe()); break; } } @@ -479,7 +479,7 @@ { __w->__is_black_ = true; __w->__parent_unsafe()->__is_black_ = false; - __tree_right_rotate(__w->__parent_unsafe()); + _VSTD::__tree_right_rotate(__w->__parent_unsafe()); // __x is still valid // reset __root only if necessary if (__root == __w->__right_) @@ -500,7 +500,7 @@ break; } // reset sibling, and it still can't be null - __w = __tree_is_left_child(__x) ? + __w = _VSTD::__tree_is_left_child(__x) ? __x->__parent_unsafe()->__right_ : __x->__parent_->__left_; // continue; @@ -512,7 +512,7 @@ // __w right child is non-null and red __w->__right_->__is_black_ = true; __w->__is_black_ = false; - __tree_left_rotate(__w); + _VSTD::__tree_left_rotate(__w); // __w is known not to be root, so root hasn't changed // reset sibling, and it still can't be null __w = __w->__parent_unsafe(); @@ -521,7 +521,7 @@ __w->__is_black_ = __w->__parent_unsafe()->__is_black_; __w->__parent_unsafe()->__is_black_ = true; __w->__left_->__is_black_ = true; - __tree_right_rotate(__w->__parent_unsafe()); + _VSTD::__tree_right_rotate(__w->__parent_unsafe()); break; } } @@ -839,7 +839,7 @@ _LIBCPP_INLINE_VISIBILITY __tree_iterator& operator++() { __ptr_ = static_cast<__iter_pointer>( - __tree_next_iter<__end_node_pointer>(static_cast<__node_base_pointer>(__ptr_))); + _VSTD::__tree_next_iter<__end_node_pointer>(static_cast<__node_base_pointer>(__ptr_))); return *this; } _LIBCPP_INLINE_VISIBILITY @@ -848,7 +848,7 @@ _LIBCPP_INLINE_VISIBILITY __tree_iterator& operator--() { - __ptr_ = static_cast<__iter_pointer>(__tree_prev_iter<__node_base_pointer>( + __ptr_ = static_cast<__iter_pointer>(_VSTD::__tree_prev_iter<__node_base_pointer>( static_cast<__end_node_pointer>(__ptr_))); return *this; } @@ -920,7 +920,7 @@ _LIBCPP_INLINE_VISIBILITY __tree_const_iterator& operator++() { __ptr_ = static_cast<__iter_pointer>( - __tree_next_iter<__end_node_pointer>(static_cast<__node_base_pointer>(__ptr_))); + _VSTD::__tree_next_iter<__end_node_pointer>(static_cast<__node_base_pointer>(__ptr_))); return *this; } @@ -930,7 +930,7 @@ _LIBCPP_INLINE_VISIBILITY __tree_const_iterator& operator--() { - __ptr_ = static_cast<__iter_pointer>(__tree_prev_iter<__node_base_pointer>( + __ptr_ = static_cast<__iter_pointer>(_VSTD::__tree_prev_iter<__node_base_pointer>( static_cast<__end_node_pointer>(__ptr_))); return *this; } @@ -1590,20 +1590,20 @@ { if (__cache->__parent_ == nullptr) return nullptr; - if (__tree_is_left_child(static_cast<__node_base_pointer>(__cache))) + if (_VSTD::__tree_is_left_child(static_cast<__node_base_pointer>(__cache))) { __cache->__parent_->__left_ = nullptr; __cache = static_cast<__node_pointer>(__cache->__parent_); if (__cache->__right_ == nullptr) return __cache; - return static_cast<__node_pointer>(__tree_leaf(__cache->__right_)); + return static_cast<__node_pointer>(_VSTD::__tree_leaf(__cache->__right_)); } // __cache is right child __cache->__parent_unsafe()->__right_ = nullptr; __cache = static_cast<__node_pointer>(__cache->__parent_); if (__cache->__left_ == nullptr) return __cache; - return static_cast<__node_pointer>(__tree_leaf(__cache->__left_)); + return static_cast<__node_pointer>(_VSTD::__tree_leaf(__cache->__left_)); } template @@ -2078,7 +2078,7 @@ __child = __new_node; if (__begin_node()->__left_ != nullptr) __begin_node() = static_cast<__iter_pointer>(__begin_node()->__left_); - __tree_balance_after_insert(__end_node()->__left_, __child); + _VSTD::__tree_balance_after_insert(__end_node()->__left_, __child); ++size(); } @@ -2248,8 +2248,8 @@ if (__begin_node() == __ptr) __begin_node() = __r.__ptr_; --size(); - __tree_remove(__end_node()->__left_, - static_cast<__node_base_pointer>(__ptr)); + _VSTD::__tree_remove(__end_node()->__left_, + static_cast<__node_base_pointer>(__ptr)); return __r; } @@ -2627,7 +2627,7 @@ return _Pp(iterator(__rt), iterator( __rt->__right_ != nullptr ? - static_cast<__iter_pointer>(__tree_min(__rt->__right_)) + static_cast<__iter_pointer>(_VSTD::__tree_min(__rt->__right_)) : __result)); } return _Pp(iterator(__result), iterator(__result)); @@ -2655,7 +2655,7 @@ return _Pp(const_iterator(__rt), const_iterator( __rt->__right_ != nullptr ? - static_cast<__iter_pointer>(__tree_min(__rt->__right_)) + static_cast<__iter_pointer>(_VSTD::__tree_min(__rt->__right_)) : __result)); } return _Pp(const_iterator(__result), const_iterator(__result)); @@ -2724,8 +2724,8 @@ __begin_node() = static_cast<__iter_pointer>(__np->__parent_); } --size(); - __tree_remove(__end_node()->__left_, - static_cast<__node_base_pointer>(__np)); + _VSTD::__tree_remove(__end_node()->__left_, + static_cast<__node_base_pointer>(__np)); return __node_holder(__np, _Dp(__node_alloc(), true)); } diff --git a/libcxx/include/array b/libcxx/include/array --- a/libcxx/include/array +++ b/libcxx/include/array @@ -500,7 +500,7 @@ static_assert( is_constructible_v<_Tp, _Tp&>, "[array.creation]/1: to_array requires copy constructible elements."); - return __to_array_lvalue_impl(__arr, make_index_sequence<_Size>()); + return _VSTD::__to_array_lvalue_impl(__arr, make_index_sequence<_Size>()); } template @@ -512,8 +512,8 @@ static_assert( is_move_constructible_v<_Tp>, "[array.creation]/4: to_array requires move constructible elements."); - return __to_array_rvalue_impl(_VSTD::move(__arr), - make_index_sequence<_Size>()); + return _VSTD::__to_array_rvalue_impl(_VSTD::move(__arr), + make_index_sequence<_Size>()); } #endif // _LIBCPP_STD_VER > 17 diff --git a/libcxx/include/bitset b/libcxx/include/bitset --- a/libcxx/include/bitset +++ b/libcxx/include/bitset @@ -990,7 +990,7 @@ size_t bitset<_Size>::count() const _NOEXCEPT { - return static_cast(__count_bool_true(base::__make_iter(0), _Size)); + return static_cast(_VSTD::__count_bool_true(base::__make_iter(0), _Size)); } template diff --git a/libcxx/include/functional b/libcxx/include/functional --- a/libcxx/include/functional +++ b/libcxx/include/functional @@ -2705,7 +2705,7 @@ __mu(_Ti& __ti, tuple<_Uj...>& __uj) { typedef typename __make_tuple_indices::type __indices; - return __mu_expand(__ti, __uj, __indices()); + return _VSTD::__mu_expand(__ti, __uj, __indices()); } template diff --git a/libcxx/include/future b/libcxx/include/future --- a/libcxx/include/future +++ b/libcxx/include/future @@ -1681,7 +1681,7 @@ _Rp __packaged_task_func<_Fp, _Alloc, _Rp(_ArgTypes...)>::operator()(_ArgTypes&& ... __arg) { - return __invoke(__f_.first(), _VSTD::forward<_ArgTypes>(__arg)...); + return _VSTD::__invoke(__f_.first(), _VSTD::forward<_ArgTypes>(__arg)...); } template class __packaged_task_function; @@ -2184,7 +2184,7 @@ _Rp __execute(__tuple_indices<_Indices...>) { - return __invoke(_VSTD::move(_VSTD::get<0>(__f_)), _VSTD::move(_VSTD::get<_Indices>(__f_))...); + return _VSTD::__invoke(_VSTD::move(_VSTD::get<0>(__f_)), _VSTD::move(_VSTD::get<_Indices>(__f_))...); } }; @@ -2204,16 +2204,16 @@ { #endif if (__does_policy_contain(__policy, launch::async)) - return _VSTD::__make_async_assoc_state<_Rp>(_BF(__decay_copy(_VSTD::forward<_Fp>(__f)), - __decay_copy(_VSTD::forward<_Args>(__args))...)); + return _VSTD::__make_async_assoc_state<_Rp>(_BF(_VSTD::__decay_copy(_VSTD::forward<_Fp>(__f)), + _VSTD::__decay_copy(_VSTD::forward<_Args>(__args))...)); #ifndef _LIBCPP_NO_EXCEPTIONS } catch ( ... ) { if (__policy == launch::async) throw ; } #endif if (__does_policy_contain(__policy, launch::deferred)) - return _VSTD::__make_deferred_assoc_state<_Rp>(_BF(__decay_copy(_VSTD::forward<_Fp>(__f)), - __decay_copy(_VSTD::forward<_Args>(__args))...)); + return _VSTD::__make_deferred_assoc_state<_Rp>(_BF(_VSTD::__decay_copy(_VSTD::forward<_Fp>(__f)), + _VSTD::__decay_copy(_VSTD::forward<_Args>(__args))...)); return future<_Rp>{}; } diff --git a/libcxx/include/iomanip b/libcxx/include/iomanip --- a/libcxx/include/iomanip +++ b/libcxx/include/iomanip @@ -527,7 +527,7 @@ __str.push_back(*__first); } __str.push_back(__delim); - return __put_character_sequence(__os, __str.data(), __str.size()); + return _VSTD::__put_character_sequence(__os, __str.data(), __str.size()); } template diff --git a/libcxx/include/mutex b/libcxx/include/mutex --- a/libcxx/include/mutex +++ b/libcxx/include/mutex @@ -626,7 +626,7 @@ _LIBCPP_INLINE_VISIBILITY void __execute(__tuple_indices<_Indices...>) { - __invoke(_VSTD::get<0>(_VSTD::move(__f_)), _VSTD::get<_Indices>(_VSTD::move(__f_))...); + _VSTD::__invoke(_VSTD::get<0>(_VSTD::move(__f_)), _VSTD::get<_Indices>(_VSTD::move(__f_))...); } }; diff --git a/libcxx/test/libcxx/containers/sequences/vector/robust_against_adl.pass.cpp b/libcxx/test/libcxx/containers/sequences/vector/robust_against_adl.pass.cpp --- a/libcxx/test/libcxx/containers/sequences/vector/robust_against_adl.pass.cpp +++ b/libcxx/test/libcxx/containers/sequences/vector/robust_against_adl.pass.cpp @@ -20,14 +20,19 @@ template> struct MyAlloc { using value_type = T; + MyAlloc() = default; + template MyAlloc(const MyAlloc&) {} T *allocate(int n) { return std::allocator().allocate(n); } void deallocate(T *p, int n) { return std::allocator().deallocate(p, n); } }; int main(int, char**) { + std::vector> vb; + std::vector> wb(100); + std::vector> v; - std::vector> w; + std::vector> w(100); v.push_back(1); v.insert(v.end(), 2); v.insert(v.end(), w.begin(), w.end());