diff --git a/libcxx/include/__memory/shared_ptr.h b/libcxx/include/__memory/shared_ptr.h --- a/libcxx/include/__memory/shared_ptr.h +++ b/libcxx/include/__memory/shared_ptr.h @@ -718,11 +718,7 @@ #endif // _LIBCPP_NO_EXCEPTIONS typedef typename __shared_ptr_default_allocator<_Yp>::type _AllocT; typedef __shared_ptr_pointer<_Yp*, _Dp, _AllocT > _CntrlBlk; -#ifndef _LIBCPP_CXX03_LANG __cntrl_ = new _CntrlBlk(__p, _VSTD::move(__d), _AllocT()); -#else - __cntrl_ = new _CntrlBlk(__p, __d, _AllocT()); -#endif // not _LIBCPP_CXX03_LANG __enable_weak_this(__p, __p); #ifndef _LIBCPP_NO_EXCEPTIONS } @@ -745,11 +741,7 @@ #endif // _LIBCPP_NO_EXCEPTIONS typedef typename __shared_ptr_default_allocator<_Tp>::type _AllocT; typedef __shared_ptr_pointer _CntrlBlk; -#ifndef _LIBCPP_CXX03_LANG __cntrl_ = new _CntrlBlk(__p, _VSTD::move(__d), _AllocT()); -#else - __cntrl_ = new _CntrlBlk(__p, __d, _AllocT()); -#endif // not _LIBCPP_CXX03_LANG #ifndef _LIBCPP_NO_EXCEPTIONS } catch (...) @@ -776,11 +768,7 @@ _A2 __a2(__a); unique_ptr<_CntrlBlk, _D2> __hold2(__a2.allocate(1), _D2(__a2, 1)); ::new ((void*)_VSTD::addressof(*__hold2.get())) -#ifndef _LIBCPP_CXX03_LANG _CntrlBlk(__p, _VSTD::move(__d), __a); -#else - _CntrlBlk(__p, __d, __a); -#endif // not _LIBCPP_CXX03_LANG __cntrl_ = _VSTD::addressof(*__hold2.release()); __enable_weak_this(__p, __p); #ifndef _LIBCPP_NO_EXCEPTIONS @@ -808,11 +796,7 @@ _A2 __a2(__a); unique_ptr<_CntrlBlk, _D2> __hold2(__a2.allocate(1), _D2(__a2, 1)); ::new ((void*)_VSTD::addressof(*__hold2.get())) -#ifndef _LIBCPP_CXX03_LANG _CntrlBlk(__p, _VSTD::move(__d), __a); -#else - _CntrlBlk(__p, __d, __a); -#endif // not _LIBCPP_CXX03_LANG __cntrl_ = _VSTD::addressof(*__hold2.release()); #ifndef _LIBCPP_NO_EXCEPTIONS } diff --git a/libcxx/include/bitset b/libcxx/include/bitset --- a/libcxx/include/bitset +++ b/libcxx/include/bitset @@ -159,7 +159,7 @@ friend class __bit_iterator<__bitset, true>; friend struct __bit_array<__bitset>; - __storage_type __first_[_N_words]; + __storage_type __first_[_N_words] = {}; typedef __bit_reference<__bitset> reference; typedef __bit_const_reference<__bitset> const_reference; @@ -167,7 +167,7 @@ typedef __bit_iterator<__bitset, true> const_iterator; _LIBCPP_INLINE_VISIBILITY - _LIBCPP_CONSTEXPR __bitset() _NOEXCEPT; + _LIBCPP_CONSTEXPR __bitset() _NOEXCEPT {} _LIBCPP_INLINE_VISIBILITY explicit _LIBCPP_CONSTEXPR __bitset(unsigned long long __v) _NOEXCEPT; @@ -214,19 +214,6 @@ unsigned long long to_ullong(true_type, true_type) const; }; -template -inline -_LIBCPP_CONSTEXPR -__bitset<_N_words, _Size>::__bitset() _NOEXCEPT -#ifndef _LIBCPP_CXX03_LANG - : __first_{0} -#endif -{ -#ifdef _LIBCPP_CXX03_LANG - _VSTD::fill_n(__first_, _N_words, __storage_type(0)); -#endif -} - #ifdef _LIBCPP_CXX03_LANG template diff --git a/libcxx/include/deque b/libcxx/include/deque --- a/libcxx/include/deque +++ b/libcxx/include/deque @@ -1053,11 +1053,9 @@ public: ~__deque_base(); -#ifndef _LIBCPP_CXX03_LANG __deque_base(__deque_base&& __c) _NOEXCEPT_(is_nothrow_move_constructible::value); __deque_base(__deque_base&& __c, const allocator_type& __a); -#endif // _LIBCPP_CXX03_LANG void swap(__deque_base& __c) #if _LIBCPP_STD_VER >= 14 @@ -1192,8 +1190,6 @@ __alloc_traits::deallocate(__alloc(), *__i, __block_size); } -#ifndef _LIBCPP_CXX03_LANG - template __deque_base<_Tp, _Allocator>::__deque_base(__deque_base&& __c) _NOEXCEPT_(is_nothrow_move_constructible::value) @@ -1224,8 +1220,6 @@ } } -#endif // _LIBCPP_CXX03_LANG - template void __deque_base<_Tp, _Allocator>::swap(__deque_base& __c) @@ -1425,7 +1419,6 @@ // 23.2.2.3 modifiers: void push_front(const value_type& __v); void push_back(const value_type& __v); -#ifndef _LIBCPP_CXX03_LANG #if _LIBCPP_STD_VER > 14 template reference emplace_front(_Args&&... __args); template reference emplace_back (_Args&&... __args); @@ -1439,6 +1432,7 @@ void push_back(value_type&& __v); iterator insert(const_iterator __p, value_type&& __v); +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY iterator insert(const_iterator __p, initializer_list __il) {return insert(__p, __il.begin(), __il.end());} @@ -1725,6 +1719,8 @@ return *this; } +#endif // _LIBCPP_CXX03_LANG + template void deque<_Tp, _Allocator>::__move_assign(deque& __c, false_type) @@ -1748,8 +1744,6 @@ __base::__move_assign(__c); } -#endif // _LIBCPP_CXX03_LANG - template template void @@ -1948,7 +1942,6 @@ ++__base::size(); } -#ifndef _LIBCPP_CXX03_LANG template void deque<_Tp, _Allocator>::push_back(value_type&& __v) @@ -2130,9 +2123,6 @@ return __base::begin() + __pos; } -#endif // _LIBCPP_CXX03_LANG - - template typename deque<_Tp, _Allocator>::iterator deque<_Tp, _Allocator>::insert(const_iterator __p, const value_type& __v) @@ -2356,11 +2346,7 @@ !__is_cpp17_forward_iterator<_InpIter>::value>::type*) { for (; __f != __l; ++__f) -#ifdef _LIBCPP_CXX03_LANG - push_back(*__f); -#else emplace_back(*__f); -#endif } template diff --git a/libcxx/include/forward_list b/libcxx/include/forward_list --- a/libcxx/include/forward_list +++ b/libcxx/include/forward_list @@ -499,20 +499,13 @@ _LIBCPP_INLINE_VISIBILITY explicit __forward_list_base(const __node_allocator& __a) : __before_begin_(__begin_node(), __a) {} -#ifndef _LIBCPP_CXX03_LANG + public: _LIBCPP_INLINE_VISIBILITY __forward_list_base(__forward_list_base&& __x) _NOEXCEPT_(is_nothrow_move_constructible<__node_allocator>::value); _LIBCPP_INLINE_VISIBILITY __forward_list_base(__forward_list_base&& __x, const allocator_type& __a); -#endif // _LIBCPP_CXX03_LANG - -private: - __forward_list_base(const __forward_list_base&); - __forward_list_base& operator=(const __forward_list_base&); - -public: ~__forward_list_base(); protected: @@ -560,8 +553,6 @@ {__alloc() = _VSTD::move(__x.__alloc());} }; -#ifndef _LIBCPP_CXX03_LANG - template inline __forward_list_base<_Tp, _Alloc>::__forward_list_base(__forward_list_base&& __x) @@ -584,8 +575,6 @@ } } -#endif // _LIBCPP_CXX03_LANG - template __forward_list_base<_Tp, _Alloc>::~__forward_list_base() { @@ -768,23 +757,21 @@ _LIBCPP_INLINE_VISIBILITY const_reference front() const {return base::__before_begin()->__next_->__value_;} -#ifndef _LIBCPP_CXX03_LANG #if _LIBCPP_STD_VER > 14 template reference emplace_front(_Args&&... __args); #else template void emplace_front(_Args&&... __args); #endif void push_front(value_type&& __v); -#endif // _LIBCPP_CXX03_LANG void push_front(const value_type& __v); void pop_front(); -#ifndef _LIBCPP_CXX03_LANG template iterator emplace_after(const_iterator __p, _Args&&... __args); iterator insert_after(const_iterator __p, value_type&& __v); +#ifndef _LIBCPP_CXX03_LANG iterator insert_after(const_iterator __p, initializer_list __il) {return insert_after(__p, __il.begin(), __il.end());} #endif // _LIBCPP_CXX03_LANG @@ -833,14 +820,12 @@ _LIBCPP_INLINE_VISIBILITY __remove_return_type unique() {return unique(__equal_to());} template __remove_return_type unique(_BinaryPredicate __binary_pred); -#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY void merge(forward_list&& __x) {merge(__x, __less());} template _LIBCPP_INLINE_VISIBILITY void merge(forward_list&& __x, _Compare __comp) {merge(__x, _VSTD::move(__comp));} -#endif // _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY void merge(forward_list& __x) {merge(__x, __less());} template void merge(forward_list& __x, _Compare __comp); @@ -851,11 +836,9 @@ private: -#ifndef _LIBCPP_CXX03_LANG void __move_assign(forward_list& __x, true_type) _NOEXCEPT_(is_nothrow_move_assignable::value); void __move_assign(forward_list& __x, false_type); -#endif // _LIBCPP_CXX03_LANG template static @@ -1108,7 +1091,6 @@ } #ifndef _LIBCPP_CXX03_LANG - template inline void @@ -1116,6 +1098,7 @@ { assign(__il.begin(), __il.end()); } +#endif // _LIBCPP_CXX03_LANG template template @@ -1150,8 +1133,6 @@ base::__before_begin()->__next_ = __h.release(); } -#endif // _LIBCPP_CXX03_LANG - template void forward_list<_Tp, _Alloc>::push_front(const value_type& __v) @@ -1175,8 +1156,6 @@ __node_traits::deallocate(__a, __p, 1); } -#ifndef _LIBCPP_CXX03_LANG - template template typename forward_list<_Tp, _Alloc>::iterator @@ -1207,8 +1186,6 @@ return iterator(__r->__next_); } -#endif // _LIBCPP_CXX03_LANG - template typename forward_list<_Tp, _Alloc>::iterator forward_list<_Tp, _Alloc>::insert_after(const_iterator __p, const value_type& __v) diff --git a/libcxx/include/list b/libcxx/include/list --- a/libcxx/include/list +++ b/libcxx/include/list @@ -601,9 +601,7 @@ __list_imp(const allocator_type& __a); _LIBCPP_INLINE_VISIBILITY __list_imp(const __node_allocator& __a); -#ifndef _LIBCPP_CXX03_LANG __list_imp(__node_allocator&& __a) _NOEXCEPT; -#endif ~__list_imp(); void clear() _NOEXCEPT; _LIBCPP_INLINE_VISIBILITY @@ -730,11 +728,9 @@ inline __list_imp<_Tp, _Alloc>::__list_imp(const __node_allocator& __a) : __size_alloc_(0, __a) {} -#ifndef _LIBCPP_CXX03_LANG template inline __list_imp<_Tp, _Alloc>::__list_imp(__node_allocator&& __a) _NOEXCEPT : __size_alloc_(0, _VSTD::move(__a)) {} -#endif template __list_imp<_Tp, _Alloc>::~__list_imp() { @@ -997,7 +993,6 @@ return base::__end_.__prev_->__as_node()->__value_; } -#ifndef _LIBCPP_CXX03_LANG void push_front(value_type&& __x); void push_back(value_type&& __x); @@ -1018,6 +1013,7 @@ iterator insert(const_iterator __p, value_type&& __x); +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY iterator insert(const_iterator __p, initializer_list __il) {return insert(__p, __il.begin(), __il.end());} @@ -1026,14 +1022,9 @@ void push_front(const value_type& __x); void push_back(const value_type& __x); -#ifndef _LIBCPP_CXX03_LANG template _LIBCPP_INLINE_VISIBILITY void __emplace_back(_Arg&& __arg) { emplace_back(_VSTD::forward<_Arg>(__arg)); } -#else - _LIBCPP_INLINE_VISIBILITY - void __emplace_back(value_type const& __arg) { push_back(__arg); } -#endif iterator insert(const_iterator __p, const value_type& __x); iterator insert(const_iterator __p, size_type __n, const value_type& __x); @@ -1063,7 +1054,6 @@ void resize(size_type __n, const value_type& __x); void splice(const_iterator __p, list& __c); -#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY void splice(const_iterator __p, list&& __c) {splice(__p, __c);} _LIBCPP_INLINE_VISIBILITY @@ -1072,7 +1062,6 @@ _LIBCPP_INLINE_VISIBILITY void splice(const_iterator __p, list&& __c, const_iterator __f, const_iterator __l) {splice(__p, __c, __f, __l);} -#endif void splice(const_iterator __p, list& __c, const_iterator __i); void splice(const_iterator __p, list& __c, const_iterator __f, const_iterator __l); @@ -1084,14 +1073,12 @@ __remove_return_type unique(_BinaryPred __binary_pred); _LIBCPP_INLINE_VISIBILITY void merge(list& __c); -#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY void merge(list&& __c) {merge(__c);} template _LIBCPP_INLINE_VISIBILITY void merge(list&& __c, _Comp __comp) {merge(__c, __comp);} -#endif template void merge(list& __c, _Comp __comp); @@ -1209,11 +1196,7 @@ __get_db()->__insert_c(this); #endif for (; __n > 0; --__n) -#ifndef _LIBCPP_CXX03_LANG emplace_back(); -#else - push_back(value_type()); -#endif } #if _LIBCPP_STD_VER > 11 @@ -1619,8 +1602,6 @@ __hold.release(); } -#ifndef _LIBCPP_CXX03_LANG - template void list<_Tp, _Alloc>::push_front(value_type&& __x) @@ -1735,8 +1716,6 @@ #endif } -#endif // _LIBCPP_CXX03_LANG - template void list<_Tp, _Alloc>::pop_front() diff --git a/libcxx/include/set b/libcxx/include/set --- a/libcxx/include/set +++ b/libcxx/include/set @@ -655,7 +655,6 @@ size_type max_size() const _NOEXCEPT {return __tree_.max_size();} // modifiers: -#ifndef _LIBCPP_CXX03_LANG template _LIBCPP_INLINE_VISIBILITY pair emplace(_Args&&... __args) @@ -664,7 +663,6 @@ _LIBCPP_INLINE_VISIBILITY iterator emplace_hint(const_iterator __p, _Args&&... __args) {return __tree_.__emplace_hint_unique(__p, _VSTD::forward<_Args>(__args)...);} -#endif // _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY pair insert(const value_type& __v) @@ -681,7 +679,6 @@ __tree_.__insert_unique(__e, *__f); } -#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY pair insert(value_type&& __v) {return __tree_.__insert_unique(_VSTD::move(__v));} @@ -690,6 +687,7 @@ iterator insert(const_iterator __p, value_type&& __v) {return __tree_.__insert_unique(__p, _VSTD::move(__v));} +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY void insert(initializer_list __il) {insert(__il.begin(), __il.end());} @@ -1186,7 +1184,6 @@ size_type max_size() const _NOEXCEPT {return __tree_.max_size();} // modifiers: -#ifndef _LIBCPP_CXX03_LANG template _LIBCPP_INLINE_VISIBILITY iterator emplace(_Args&&... __args) @@ -1195,7 +1192,6 @@ _LIBCPP_INLINE_VISIBILITY iterator emplace_hint(const_iterator __p, _Args&&... __args) {return __tree_.__emplace_hint_multi(__p, _VSTD::forward<_Args>(__args)...);} -#endif // _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY iterator insert(const value_type& __v) @@ -1212,7 +1208,6 @@ __tree_.__insert_multi(__e, *__f); } -#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY iterator insert(value_type&& __v) {return __tree_.__insert_multi(_VSTD::move(__v));} @@ -1221,6 +1216,7 @@ iterator insert(const_iterator __p, value_type&& __v) {return __tree_.__insert_multi(__p, _VSTD::move(__v));} +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY void insert(initializer_list __il) {insert(__il.begin(), __il.end());} diff --git a/libcxx/include/vector b/libcxx/include/vector --- a/libcxx/include/vector +++ b/libcxx/include/vector @@ -362,9 +362,7 @@ __vector_base() _NOEXCEPT_(is_nothrow_default_constructible::value); _LIBCPP_INLINE_VISIBILITY __vector_base(const allocator_type& __a); -#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY __vector_base(allocator_type&& __a) _NOEXCEPT; -#endif ~__vector_base(); _LIBCPP_INLINE_VISIBILITY @@ -448,14 +446,12 @@ { } -#ifndef _LIBCPP_CXX03_LANG template inline _LIBCPP_INLINE_VISIBILITY __vector_base<_Tp, _Allocator>::__vector_base(allocator_type&& __a) _NOEXCEPT : __begin_(nullptr), __end_(nullptr), __end_cap_(nullptr, _VSTD::move(__a)) {} -#endif template __vector_base<_Tp, _Allocator>::~__vector_base() @@ -699,20 +695,13 @@ const value_type* data() const _NOEXCEPT {return _VSTD::__to_address(this->__begin_);} -#ifdef _LIBCPP_CXX03_LANG - _LIBCPP_INLINE_VISIBILITY - void __emplace_back(const value_type& __x) { push_back(__x); } -#else template _LIBCPP_INLINE_VISIBILITY void __emplace_back(_Arg&& __arg) { emplace_back(_VSTD::forward<_Arg>(__arg)); } -#endif _LIBCPP_INLINE_VISIBILITY void push_back(const_reference __x); - -#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY void push_back(value_type&& __x); template @@ -722,18 +711,15 @@ #else void emplace_back(_Args&&... __args); #endif -#endif // !_LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY void pop_back(); iterator insert(const_iterator __position, const_reference __x); -#ifndef _LIBCPP_CXX03_LANG iterator insert(const_iterator __position, value_type&& __x); template iterator emplace(const_iterator __position, _Args&&... __args); -#endif // !_LIBCPP_CXX03_LANG iterator insert(const_iterator __position, size_type __n, const_reference __x); template @@ -836,7 +822,6 @@ __annotate_shrink(__old_size); } -#ifndef _LIBCPP_CXX03_LANG template _LIBCPP_INLINE_VISIBILITY inline void __push_back_slow_path(_Up&& __x); @@ -844,11 +829,6 @@ template _LIBCPP_INLINE_VISIBILITY inline void __emplace_back_slow_path(_Args&&... __args); -#else - template - _LIBCPP_INLINE_VISIBILITY - inline void __push_back_slow_path(_Up& __x); -#endif // The following functions are no-ops outside of AddressSanitizer mode. // We call annotatations only for the default Allocator because other allocators @@ -1614,11 +1594,7 @@ template template void -#ifndef _LIBCPP_CXX03_LANG vector<_Tp, _Allocator>::__push_back_slow_path(_Up&& __x) -#else -vector<_Tp, _Allocator>::__push_back_slow_path(_Up& __x) -#endif { allocator_type& __a = this->__alloc(); __split_buffer __v(__recommend(size() + 1), size(), __a); @@ -1641,8 +1617,6 @@ __push_back_slow_path(__x); } -#ifndef _LIBCPP_CXX03_LANG - template inline _LIBCPP_INLINE_VISIBILITY void @@ -1690,8 +1664,6 @@ #endif } -#endif // !_LIBCPP_CXX03_LANG - template inline void @@ -1797,8 +1769,6 @@ return __make_iter(__p); } -#ifndef _LIBCPP_CXX03_LANG - template typename vector<_Tp, _Allocator>::iterator vector<_Tp, _Allocator>::insert(const_iterator __position, value_type&& __x) @@ -1865,8 +1835,6 @@ return __make_iter(__p); } -#endif // !_LIBCPP_CXX03_LANG - template typename vector<_Tp, _Allocator>::iterator vector<_Tp, _Allocator>::insert(const_iterator __position, size_type __n, const_reference __x)