diff --git a/stl/inc/codecvt b/stl/inc/codecvt index 7b9d11fe4a1..01b07efb80c 100644 --- a/stl/inc/codecvt +++ b/stl/inc/codecvt @@ -21,9 +21,8 @@ _STL_DISABLE_CLANG_WARNINGS #pragma warning(disable : 4127) // conditional expression is constant _STD_BEGIN -#define _LITTLE_FIRST 1 -#define _BIG_FIRST 2 -#define _BYTES_PER_WORD 4 +_INLINE_VAR constexpr int _Little_first = 1; +_INLINE_VAR constexpr int _Big_first = 2; enum _CXX17_DEPRECATE_CODECVT_HEADER codecvt_mode { consume_header = 4, generate_header = 2, little_endian = 1 }; @@ -249,13 +248,13 @@ protected: unsigned short _Ch0; unsigned short _Ch1; - if (*_Pstate == _LITTLE_FIRST) { + if (*_Pstate == _Little_first) { _Ch0 = static_cast(_Ptr[1] << 8 | _Ptr[0]); - } else if (*_Pstate == _BIG_FIRST) { + } else if (*_Pstate == _Big_first) { _Ch0 = static_cast(_Ptr[0] << 8 | _Ptr[1]); } else { // no header seen yet, try preferred mode constexpr bool _Prefer_LE = (_Mymode & little_endian) != 0; - constexpr char _Default_endian = _Prefer_LE ? _LITTLE_FIRST : _BIG_FIRST; + constexpr char _Default_endian = _Prefer_LE ? _Little_first : _Big_first; if _CONSTEXPR_IF(_Prefer_LE) { @@ -293,7 +292,7 @@ protected: } else if (_Last1 - _Mid1 < 2 * _Bytes_per_word) { break; } else { // get second word - if (*_Pstate == _LITTLE_FIRST) { + if (*_Pstate == _Little_first) { _Ch1 = static_cast(_Ptr[3] << 8 | _Ptr[2]); } else { _Ch1 = static_cast(_Ptr[2] << 8 | _Ptr[3]); @@ -325,7 +324,7 @@ protected: _Mid2 = _First2; if (*_Pstate == 0) { // determine endianness once, maybe generate header - *_Pstate = (_Mymode & little_endian) != 0 ? _LITTLE_FIRST : _BIG_FIRST; + *_Pstate = (_Mymode & little_endian) != 0 ? _Little_first : _Big_first; constexpr bool _Generating = (_Mymode & generate_header) != 0; if _CONSTEXPR_IF(_Generating) { @@ -333,7 +332,7 @@ protected: return _Mybase::partial; // not enough room for all } - if (*_Pstate == _LITTLE_FIRST) { // put header LS byte first + if (*_Pstate == _Little_first) { // put header LS byte first *_Mid2++ = '\xff'; *_Mid2++ = '\xfe'; } else { // put header MS byte first @@ -362,7 +361,7 @@ protected: _Extra = true; } - if (*_Pstate == _LITTLE_FIRST) { + if (*_Pstate == _Little_first) { if (_Extra) { // put a pair of words LS byte first unsigned short _Ch0 = static_cast(0xd800 | static_cast(_Ch >> 10) - 0x0040); diff --git a/stl/inc/cvt/one_one b/stl/inc/cvt/one_one index ea6950d691f..16d18575dd0 100644 --- a/stl/inc/cvt/one_one +++ b/stl/inc/cvt/one_one @@ -62,17 +62,17 @@ namespace stdext { const auto _Ptr = reinterpret_cast(_Mid1); unsigned long _Ch = 0; - if (*_Pstate == _LITTLE_FIRST) { + if (*_Pstate == _STD _Little_first) { for (_Count = _Bytes_per_word; 0 < _Count;) { _Ch = _Ch << 8 | _Ptr[--_Count]; } - } else if (*_Pstate == _BIG_FIRST) { + } else if (*_Pstate == _STD _Big_first) { for (_Count = 0; _Count < _Bytes_per_word; ++_Count) { _Ch = _Ch << 8 | _Ptr[_Count]; } } else { // no header seen yet, try preferred mode - constexpr unsigned char _Default_endian = - (_Mode & _STD little_endian) != 0 ? _LITTLE_FIRST : _BIG_FIRST; + constexpr unsigned char _Default_endian = static_cast( + (_Mode & _STD little_endian) != 0 ? _STD _Little_first : _STD _Big_first); if _CONSTEXPR_IF((_Mode & _STD little_endian) != 0) { @@ -129,10 +129,10 @@ namespace stdext { if _CONSTEXPR_IF((_Mode & _STD little_endian) != 0) { - *_Pstate = _LITTLE_FIRST; + *_Pstate = _STD _Little_first; } else { - *_Pstate = _BIG_FIRST; + *_Pstate = _STD _Big_first; } if @@ -141,7 +141,7 @@ namespace stdext { } else if (_Last2 - _Mid2 < 2 * _Bytes_per_word) { return _Mybase::partial; // not enough room for both - } else if (*_Pstate == _LITTLE_FIRST) { + } else if (*_Pstate == _STD _Little_first) { for (_Count = 0; _Count < _Bytes_per_word; ++_Count) { // put LS byte first *_Mid2++ = static_cast<_Byte>(static_cast(_Header)); _Header >>= 8; @@ -162,7 +162,7 @@ namespace stdext { return _Mybase::error; } - if (*_Pstate == _LITTLE_FIRST) { + if (*_Pstate == _STD _Little_first) { for (_Count = 0; _Count < _Bytes_per_word; ++_Count) { // put LS byte first *_Mid2++ = static_cast<_Byte>(static_cast(_Ch)); _Ch >>= 8; diff --git a/stl/inc/cvt/utf16 b/stl/inc/cvt/utf16 index 1a12b6400c2..7112e50eec1 100644 --- a/stl/inc/cvt/utf16 +++ b/stl/inc/cvt/utf16 @@ -63,13 +63,13 @@ namespace stdext { unsigned short _Ch0; unsigned short _Ch1; - if (*_Pstate == _LITTLE_FIRST) { + if (*_Pstate == _STD _Little_first) { _Ch0 = static_cast(_Ptr[1] << 8 | _Ptr[0]); - } else if (*_Pstate == _BIG_FIRST) { + } else if (*_Pstate == _STD _Big_first) { _Ch0 = static_cast(_Ptr[0] << 8 | _Ptr[1]); } else { // no header seen yet, try preferred mode - constexpr unsigned char _Default_endian = - (_Mode & _STD little_endian) != 0 ? _LITTLE_FIRST : _BIG_FIRST; + constexpr unsigned char _Default_endian = static_cast( + (_Mode & _STD little_endian) != 0 ? _STD _Little_first : _STD _Big_first); if _CONSTEXPR_IF((_Mode & _STD little_endian) != 0) { @@ -105,7 +105,7 @@ namespace stdext { } else if (_Last1 - _Mid1 < 2 * _Bytes_per_word) { break; } else { // get second word - if (*_Pstate == _LITTLE_FIRST) { + if (*_Pstate == _STD _Little_first) { _Ch1 = static_cast(_Ptr[3] << 8 | _Ptr[2]); } else { _Ch1 = static_cast(_Ptr[2] << 8 | _Ptr[3]); @@ -138,10 +138,10 @@ namespace stdext { if (*_Pstate == 0) { // determine endianness once, maybe generate header if _CONSTEXPR_IF((_Mode & _STD little_endian) != 0) { - *_Pstate = _LITTLE_FIRST; + *_Pstate = _STD _Little_first; } else { - *_Pstate = _BIG_FIRST; + *_Pstate = _STD _Big_first; } if @@ -150,7 +150,7 @@ namespace stdext { return _Mybase::partial; // not enough room for both } - if (*_Pstate == _LITTLE_FIRST) { // put header LS byte first + if (*_Pstate == _STD _Little_first) { // put header LS byte first *_Mid2++ = '\xff'; *_Mid2++ = '\xfe'; } else { // put header MS byte first @@ -177,7 +177,7 @@ namespace stdext { _Extra = true; } - if (*_Pstate == _LITTLE_FIRST) { + if (*_Pstate == _STD _Little_first) { if (!_Extra) { // put a single word LS byte first *_Mid2++ = static_cast<_Byte>(_Ch); *_Mid2++ = static_cast<_Byte>(_Ch >> 8); diff --git a/stl/inc/deque b/stl/inc/deque index 131c2442557..32e6bcb0690 100644 --- a/stl/inc/deque +++ b/stl/inc/deque @@ -592,23 +592,23 @@ public: using const_reverse_iterator = _STD reverse_iterator; enum { _EEN_DS = _DEQUESIZ }; // helper for expression evaluator - deque() : _Mypair(_Zero_then_variadic_args_t()) { + deque() : _Mypair(_Zero_then_variadic_args_t{}) { _Get_data()._Alloc_proxy(static_cast<_Alproxy_ty>(_Getal())); } - explicit deque(const _Alloc& _Al) : _Mypair(_One_then_variadic_args_t(), _Al) { + explicit deque(const _Alloc& _Al) : _Mypair(_One_then_variadic_args_t{}, _Al) { _Get_data()._Alloc_proxy(static_cast<_Alproxy_ty>(_Getal())); } explicit deque(_CRT_GUARDOVERFLOW size_type _Count, const _Alloc& _Al = _Alloc()) - : _Mypair(_One_then_variadic_args_t(), _Al) { + : _Mypair(_One_then_variadic_args_t{}, _Al) { _Alproxy_ty _Alproxy(_Getal()); _Container_proxy_ptr12<_Alproxy_ty> _Proxy(_Alproxy, _Get_data()); resize(_Count); _Proxy._Release(); } - deque(_CRT_GUARDOVERFLOW size_type _Count, const _Ty& _Val) : _Mypair(_Zero_then_variadic_args_t()) { + deque(_CRT_GUARDOVERFLOW size_type _Count, const _Ty& _Val) : _Mypair(_Zero_then_variadic_args_t{}) { _Alproxy_ty _Alproxy(_Getal()); _Container_proxy_ptr12<_Alproxy_ty> _Proxy(_Alproxy, _Get_data()); _Construct_n(_Count, _Val); @@ -616,7 +616,7 @@ public: } deque(_CRT_GUARDOVERFLOW size_type _Count, const _Ty& _Val, const _Alloc& _Al) - : _Mypair(_One_then_variadic_args_t(), _Al) { + : _Mypair(_One_then_variadic_args_t{}, _Al) { _Alproxy_ty _Alproxy(_Getal()); _Container_proxy_ptr12<_Alproxy_ty> _Proxy(_Alproxy, _Get_data()); _Construct_n(_Count, _Val); @@ -624,14 +624,14 @@ public: } deque(const deque& _Right) - : _Mypair(_One_then_variadic_args_t(), _Alty_traits::select_on_container_copy_construction(_Right._Getal())) { + : _Mypair(_One_then_variadic_args_t{}, _Alty_traits::select_on_container_copy_construction(_Right._Getal())) { _Alproxy_ty _Alproxy(_Getal()); _Container_proxy_ptr12<_Alproxy_ty> _Proxy(_Alproxy, _Get_data()); _Construct(_Right._Unchecked_begin(), _Right._Unchecked_end()); _Proxy._Release(); } - deque(const deque& _Right, const _Alloc& _Al) : _Mypair(_One_then_variadic_args_t(), _Al) { + deque(const deque& _Right, const _Alloc& _Al) : _Mypair(_One_then_variadic_args_t{}, _Al) { _Alproxy_ty _Alproxy(_Getal()); _Container_proxy_ptr12<_Alproxy_ty> _Proxy(_Alproxy, _Get_data()); _Construct(_Right._Unchecked_begin(), _Right._Unchecked_end()); @@ -639,7 +639,7 @@ public: } template , int> = 0> - deque(_Iter _First, _Iter _Last) : _Mypair(_Zero_then_variadic_args_t()) { + deque(_Iter _First, _Iter _Last) : _Mypair(_Zero_then_variadic_args_t{}) { _Alproxy_ty _Alproxy(_Getal()); _Container_proxy_ptr12<_Alproxy_ty> _Proxy(_Alproxy, _Get_data()); _Construct(_First, _Last); @@ -647,7 +647,7 @@ public: } template , int> = 0> - deque(_Iter _First, _Iter _Last, const _Alloc& _Al) : _Mypair(_One_then_variadic_args_t(), _Al) { + deque(_Iter _First, _Iter _Last, const _Alloc& _Al) : _Mypair(_One_then_variadic_args_t{}, _Al) { _Alproxy_ty _Alproxy(_Getal()); _Container_proxy_ptr12<_Alproxy_ty> _Proxy(_Alproxy, _Get_data()); _Construct(_First, _Last); @@ -703,12 +703,12 @@ private: #define _PUSH_BACK_END ++_Mysize() public: - deque(deque&& _Right) : _Mypair(_One_then_variadic_args_t(), _STD move(_Right._Getal())) { + deque(deque&& _Right) : _Mypair(_One_then_variadic_args_t{}, _STD move(_Right._Getal())) { _Get_data()._Alloc_proxy(static_cast<_Alproxy_ty>(_Getal())); _Take_contents(_Right); } - deque(deque&& _Right, const _Alloc& _Al) : _Mypair(_One_then_variadic_args_t(), _Al) { + deque(deque&& _Right, const _Alloc& _Al) : _Mypair(_One_then_variadic_args_t{}, _Al) { _Alproxy_ty _Alproxy(_Getal()); if _CONSTEXPR_IF(!_Alty_traits::is_always_equal::value) { @@ -846,7 +846,7 @@ public: } deque(initializer_list<_Ty> _Ilist, const _Alloc& _Al = allocator_type()) - : _Mypair(_One_then_variadic_args_t(), _Al) { + : _Mypair(_One_then_variadic_args_t{}, _Al) { _Alproxy_ty _Alproxy(_Getal()); _Container_proxy_ptr12<_Alproxy_ty> _Proxy(_Alproxy, _Get_data()); _Construct(_Ilist.begin(), _Ilist.end()); diff --git a/stl/inc/execution b/stl/inc/execution index ebfb717d802..a5f29a3b6cf 100644 --- a/stl/inc/execution +++ b/stl/inc/execution @@ -4352,7 +4352,9 @@ _NODISCARD _Ty transform_reduce(_ExPo&&, const _FwdIt _First, const _FwdIt _Last } // PARALLEL FUNCTION TEMPLATE exclusive_scan -struct _No_init_tag {}; // tag to indicate that no initial value is to be used +struct _No_init_tag { + explicit _No_init_tag() = default; +}; // tag to indicate that no initial value is to be used template _FwdIt2 _Exclusive_scan_per_chunk(_FwdIt1 _First, const _FwdIt1 _Last, _FwdIt2 _Dest, _BinOp _Reduce_op, _Ty& _Val) { diff --git a/stl/inc/forward_list b/stl/inc/forward_list index 89ede1b0073..e6b84bc5928 100644 --- a/stl/inc/forward_list +++ b/stl/inc/forward_list @@ -542,12 +542,12 @@ public: using _Unchecked_const_iterator = _Flist_unchecked_const_iterator<_Scary_val>; forward_list() noexcept(is_nothrow_default_constructible_v<_Alnode>) // strengthened - : _Mypair(_Zero_then_variadic_args_t()) { + : _Mypair(_Zero_then_variadic_args_t{}) { _Alloc_proxy(); } explicit forward_list(_CRT_GUARDOVERFLOW size_type _Count, const _Alloc& _Al = _Alloc()) - : _Mypair(_One_then_variadic_args_t(), _Al) { // construct list from _Count * _Ty(), optional allocator + : _Mypair(_One_then_variadic_args_t{}, _Al) { // construct list from _Count * _Ty(), optional allocator _Flist_insert_after_op2<_Alnode> _Insert_op(_Getal()); _Insert_op._Append_n(_Count); _Alloc_proxy(); @@ -555,7 +555,7 @@ public: } forward_list(_CRT_GUARDOVERFLOW size_type _Count, const _Ty& _Val) - : _Mypair(_Zero_then_variadic_args_t()) { // construct list from _Count * _Val + : _Mypair(_Zero_then_variadic_args_t{}) { // construct list from _Count * _Val _Flist_insert_after_op2<_Alnode> _Insert_op(_Getal()); _Insert_op._Append_n(_Count, _Val); _Alloc_proxy(); @@ -563,7 +563,7 @@ public: } forward_list(_CRT_GUARDOVERFLOW size_type _Count, const _Ty& _Val, const _Alloc& _Al) - : _Mypair(_One_then_variadic_args_t(), _Al) { // construct list from _Count * _Val, allocator + : _Mypair(_One_then_variadic_args_t{}, _Al) { // construct list from _Count * _Val, allocator _Flist_insert_after_op2<_Alnode> _Insert_op(_Getal()); _Insert_op._Append_n(_Count, _Val); _Alloc_proxy(); @@ -571,19 +571,19 @@ public: } explicit forward_list(const _Alloc& _Al) noexcept // strengthened - : _Mypair(_One_then_variadic_args_t(), _Al) { + : _Mypair(_One_then_variadic_args_t{}, _Al) { _Alloc_proxy(); } forward_list(const forward_list& _Right) - : _Mypair(_One_then_variadic_args_t(), _Alnode_traits::select_on_container_copy_construction(_Right._Getal())) { + : _Mypair(_One_then_variadic_args_t{}, _Alnode_traits::select_on_container_copy_construction(_Right._Getal())) { _Flist_insert_after_op2<_Alnode> _Insert_op(_Getal()); _Insert_op._Append_range_unchecked(_Right._Unchecked_begin(), _Right._Unchecked_end()); _Alloc_proxy(); _Insert_op._Attach_after(_Mypair._Myval2._Before_head()); } - forward_list(const forward_list& _Right, const _Alloc& _Al) : _Mypair(_One_then_variadic_args_t(), _Al) { + forward_list(const forward_list& _Right, const _Alloc& _Al) : _Mypair(_One_then_variadic_args_t{}, _Al) { _Flist_insert_after_op2<_Alnode> _Insert_op(_Getal()); _Insert_op._Append_range_unchecked(_Right._Unchecked_begin(), _Right._Unchecked_end()); _Alloc_proxy(); @@ -591,7 +591,7 @@ public: } template , int> = 0> - forward_list(_Iter _First, _Iter _Last) : _Mypair(_Zero_then_variadic_args_t()) { + forward_list(_Iter _First, _Iter _Last) : _Mypair(_Zero_then_variadic_args_t{}) { _Adl_verify_range(_First, _Last); _Flist_insert_after_op2<_Alnode> _Insert_op(_Getal()); _Insert_op._Append_range_unchecked(_Get_unwrapped(_First), _Get_unwrapped(_Last)); @@ -600,7 +600,7 @@ public: } template , int> = 0> - forward_list(_Iter _First, _Iter _Last, const _Alloc& _Al) : _Mypair(_One_then_variadic_args_t(), _Al) { + forward_list(_Iter _First, _Iter _Last, const _Alloc& _Al) : _Mypair(_One_then_variadic_args_t{}, _Al) { _Adl_verify_range(_First, _Last); _Flist_insert_after_op2<_Alnode> _Insert_op(_Getal()); _Insert_op._Append_range_unchecked(_Get_unwrapped(_First), _Get_unwrapped(_Last)); @@ -609,14 +609,14 @@ public: } forward_list(forward_list&& _Right) noexcept // strengthened - : _Mypair(_One_then_variadic_args_t(), _STD move(_Right._Getal())) { + : _Mypair(_One_then_variadic_args_t{}, _STD move(_Right._Getal())) { _Alloc_proxy(); _Take_head(_Right); } forward_list(forward_list&& _Right, const _Alloc& _Al) noexcept( _Alnode_traits::is_always_equal::value) // strengthened - : _Mypair(_One_then_variadic_args_t(), _Al) { + : _Mypair(_One_then_variadic_args_t{}, _Al) { if _CONSTEXPR_IF(!_Alty_traits::is_always_equal::value) { if (_Getal() != _Right._Getal()) { @@ -718,7 +718,7 @@ private: public: forward_list(initializer_list<_Ty> _Ilist, const _Alloc& _Al = allocator_type()) - : _Mypair(_One_then_variadic_args_t(), _Al) { + : _Mypair(_One_then_variadic_args_t{}, _Al) { auto&& _Alproxy = _GET_PROXY_ALLOCATOR(_Alnode, _Getal()); _Container_proxy_ptr<_Alty> _Proxy(_Alproxy, _Mypair._Myval2); insert_after(before_begin(), _Ilist.begin(), _Ilist.end()); diff --git a/stl/inc/functional b/stl/inc/functional index 14152accf31..840c0def7f1 100644 --- a/stl/inc/functional +++ b/stl/inc/functional @@ -669,7 +669,9 @@ struct identity { #if _HAS_CXX17 // FUNCTION TEMPLATE not_fn -struct _Not_fn_tag {}; +struct _Not_fn_tag { + explicit _Not_fn_tag() = default; +}; template class _Not_fn : private _Ebco_base<_Decayed> { @@ -818,7 +820,7 @@ public: template _Func_impl(_Other1&& _Val, _Other2&& _Ax) - : _Mypair(_One_then_variadic_args_t(), _STD forward<_Other2>(_Ax), _STD forward<_Other1>(_Val)) {} + : _Mypair(_One_then_variadic_args_t{}, _STD forward<_Other2>(_Ax), _STD forward<_Other1>(_Val)) {} // dtor non-virtual due to _Delete_this() @@ -1454,7 +1456,7 @@ private: public: explicit _Binder(_Fx&& _Func, _Types&&... _Args) - : _Mypair(_One_then_variadic_args_t(), _STD forward<_Fx>(_Func), _STD forward<_Types>(_Args)...) {} + : _Mypair(_One_then_variadic_args_t{}, _STD forward<_Fx>(_Func), _STD forward<_Types>(_Args)...) {} #define _BINDER_OPERATOR(CONST_OPT) \ template \ diff --git a/stl/inc/list b/stl/inc/list index 0d7b4dd742b..1ff9a6dcb9e 100644 --- a/stl/inc/list +++ b/stl/inc/list @@ -801,17 +801,17 @@ public: using reverse_iterator = _STD reverse_iterator; using const_reverse_iterator = _STD reverse_iterator; - list() : _Mypair(_Zero_then_variadic_args_t()) { + list() : _Mypair(_Zero_then_variadic_args_t{}) { _Alloc_sentinel_and_proxy(); } - explicit list(const _Alloc& _Al) : _Mypair(_One_then_variadic_args_t(), _Al) { + explicit list(const _Alloc& _Al) : _Mypair(_One_then_variadic_args_t{}, _Al) { _Alloc_sentinel_and_proxy(); } private: template - explicit list(_Move_allocator_tag, _Any_alloc& _Al) : _Mypair(_One_then_variadic_args_t(), _STD move(_Al)) { + explicit list(_Move_allocator_tag, _Any_alloc& _Al) : _Mypair(_One_then_variadic_args_t{}, _STD move(_Al)) { _Alloc_sentinel_and_proxy(); } @@ -826,12 +826,12 @@ private: public: explicit list(_CRT_GUARDOVERFLOW size_type _Count) - : _Mypair(_Zero_then_variadic_args_t()) { // construct list from _Count * _Ty() + : _Mypair(_Zero_then_variadic_args_t{}) { // construct list from _Count * _Ty() _Construct_n(_Count); } explicit list(_CRT_GUARDOVERFLOW size_type _Count, const _Alloc& _Al) - : _Mypair(_One_then_variadic_args_t(), _Al) { // construct list from _Count * _Ty(), with allocator + : _Mypair(_One_then_variadic_args_t{}, _Al) { // construct list from _Count * _Ty(), with allocator _Construct_n(_Count); } @@ -847,12 +847,12 @@ private: public: list(_CRT_GUARDOVERFLOW size_type _Count, const _Ty& _Val) - : _Mypair(_Zero_then_variadic_args_t()) { // construct list from _Count * _Val + : _Mypair(_Zero_then_variadic_args_t{}) { // construct list from _Count * _Val _Construct_n(_Count, _Val); } list(_CRT_GUARDOVERFLOW size_type _Count, const _Ty& _Val, const _Alloc& _Al) - : _Mypair(_One_then_variadic_args_t(), _Al) { // construct list from _Count * _Val, allocator + : _Mypair(_One_then_variadic_args_t{}, _Al) { // construct list from _Count * _Val, allocator _Construct_n(_Count, _Val); } @@ -869,32 +869,32 @@ private: public: list(const list& _Right) - : _Mypair(_One_then_variadic_args_t(), _Alnode_traits::select_on_container_copy_construction(_Right._Getal())) { + : _Mypair(_One_then_variadic_args_t{}, _Alnode_traits::select_on_container_copy_construction(_Right._Getal())) { _Construct_range_unchecked(_Right._Unchecked_begin(), _Right._Unchecked_end()); } - list(const list& _Right, const _Alloc& _Al) : _Mypair(_One_then_variadic_args_t(), _Al) { + list(const list& _Right, const _Alloc& _Al) : _Mypair(_One_then_variadic_args_t{}, _Al) { _Construct_range_unchecked(_Right._Unchecked_begin(), _Right._Unchecked_end()); } template , int> = 0> - list(_Iter _First, _Iter _Last) : _Mypair(_Zero_then_variadic_args_t()) { + list(_Iter _First, _Iter _Last) : _Mypair(_Zero_then_variadic_args_t{}) { _Adl_verify_range(_First, _Last); _Construct_range_unchecked(_Get_unwrapped(_First), _Get_unwrapped(_Last)); } template , int> = 0> - list(_Iter _First, _Iter _Last, const _Alloc& _Al) : _Mypair(_One_then_variadic_args_t(), _Al) { + list(_Iter _First, _Iter _Last, const _Alloc& _Al) : _Mypair(_One_then_variadic_args_t{}, _Al) { _Adl_verify_range(_First, _Last); _Construct_range_unchecked(_Get_unwrapped(_First), _Get_unwrapped(_Last)); } - list(list&& _Right) : _Mypair(_One_then_variadic_args_t(), _STD move(_Right._Getal())) { + list(list&& _Right) : _Mypair(_One_then_variadic_args_t{}, _STD move(_Right._Getal())) { _Alloc_sentinel_and_proxy(); _Swap_val(_Right); } - list(list&& _Right, const _Alloc& _Al) : _Mypair(_One_then_variadic_args_t(), _Al) { + list(list&& _Right, const _Alloc& _Al) : _Mypair(_One_then_variadic_args_t{}, _Al) { if _CONSTEXPR_IF(!_Alnode_traits::is_always_equal::value) { if (_Getal() != _Right._Getal()) { @@ -1021,11 +1021,11 @@ public: return _Op._Transfer_before(_Where); } - list(initializer_list<_Ty> _Ilist) : _Mypair(_Zero_then_variadic_args_t()) { + list(initializer_list<_Ty> _Ilist) : _Mypair(_Zero_then_variadic_args_t{}) { _Construct_range_unchecked(_Ilist.begin(), _Ilist.end()); } - list(initializer_list<_Ty> _Ilist, const _Alloc& _Al) : _Mypair(_One_then_variadic_args_t(), _Al) { + list(initializer_list<_Ty> _Ilist, const _Alloc& _Al) : _Mypair(_One_then_variadic_args_t{}, _Al) { _Construct_range_unchecked(_Ilist.begin(), _Ilist.end()); } diff --git a/stl/inc/memory b/stl/inc/memory index a605d2ae01f..9b5fa6e73ca 100644 --- a/stl/inc/memory +++ b/stl/inc/memory @@ -690,7 +690,7 @@ template class _Ref_count_resource : public _Ref_count_base { // handle reference counting for object with deleter public: _Ref_count_resource(_Resource _Px, _Dx _Dt) - : _Ref_count_base(), _Mypair(_One_then_variadic_args_t(), _STD move(_Dt), _Px) {} + : _Ref_count_base(), _Mypair(_One_then_variadic_args_t{}, _STD move(_Dt), _Px) {} virtual void* _Get_deleter(const type_info& _Typeid) const noexcept override { #if _HAS_STATIC_RTTI @@ -723,7 +723,7 @@ class _Ref_count_resource_alloc : public _Ref_count_base { public: _Ref_count_resource_alloc(_Resource _Px, _Dx _Dt, const _Alloc& _Ax) : _Ref_count_base(), - _Mypair(_One_then_variadic_args_t(), _STD move(_Dt), _One_then_variadic_args_t(), _Ax, _Px) {} + _Mypair(_One_then_variadic_args_t{}, _STD move(_Dt), _One_then_variadic_args_t{}, _Ax, _Px) {} virtual void* _Get_deleter(const type_info& _Typeid) const noexcept override { #if _HAS_STATIC_RTTI @@ -1801,10 +1801,10 @@ public: using deleter_type = _Dx; template = 0> - constexpr unique_ptr() noexcept : _Mypair(_Zero_then_variadic_args_t()) {} + constexpr unique_ptr() noexcept : _Mypair(_Zero_then_variadic_args_t{}) {} template = 0> - constexpr unique_ptr(nullptr_t) noexcept : _Mypair(_Zero_then_variadic_args_t()) {} + constexpr unique_ptr(nullptr_t) noexcept : _Mypair(_Zero_then_variadic_args_t{}) {} unique_ptr& operator=(nullptr_t) noexcept { reset(); @@ -1812,14 +1812,14 @@ public: } template = 0> - explicit unique_ptr(pointer _Ptr) noexcept : _Mypair(_Zero_then_variadic_args_t(), _Ptr) {} + explicit unique_ptr(pointer _Ptr) noexcept : _Mypair(_Zero_then_variadic_args_t{}, _Ptr) {} template , int> = 0> - unique_ptr(pointer _Ptr, const _Dx& _Dt) noexcept : _Mypair(_One_then_variadic_args_t(), _Dt, _Ptr) {} + unique_ptr(pointer _Ptr, const _Dx& _Dt) noexcept : _Mypair(_One_then_variadic_args_t{}, _Dt, _Ptr) {} template >, is_constructible<_Dx2, _Dx2>>, int> = 0> - unique_ptr(pointer _Ptr, _Dx&& _Dt) noexcept : _Mypair(_One_then_variadic_args_t(), _STD move(_Dt), _Ptr) {} + unique_ptr(pointer _Ptr, _Dx&& _Dt) noexcept : _Mypair(_One_then_variadic_args_t{}, _STD move(_Dt), _Ptr) {} template , is_constructible<_Dx2, remove_reference_t<_Dx2>>>, int> = 0> @@ -1829,7 +1829,7 @@ public: template , int> = 0> #endif // _M_CEE unique_ptr(unique_ptr&& _Right) noexcept - : _Mypair(_One_then_variadic_args_t(), _STD forward<_Dx>(_Right.get_deleter()), _Right.release()) { + : _Mypair(_One_then_variadic_args_t{}, _STD forward<_Dx>(_Right.get_deleter()), _Right.release()) { } template , is_same<_Dx2, _Dx>, is_convertible<_Dx2, _Dx>>>, int> = 0> unique_ptr(unique_ptr<_Ty2, _Dx2>&& _Right) noexcept - : _Mypair(_One_then_variadic_args_t(), _STD forward<_Dx2>(_Right.get_deleter()), _Right.release()) {} + : _Mypair(_One_then_variadic_args_t{}, _STD forward<_Dx2>(_Right.get_deleter()), _Right.release()) {} #if _HAS_AUTO_PTR_ETC template , is_same<_Dx, default_delete<_Ty>>>, int> = 0> - unique_ptr(auto_ptr<_Ty2>&& _Right) noexcept : _Mypair(_Zero_then_variadic_args_t(), _Right.release()) {} + unique_ptr(auto_ptr<_Ty2>&& _Right) noexcept : _Mypair(_Zero_then_variadic_args_t{}, _Right.release()) {} #endif // _HAS_AUTO_PTR_ETC template = 0> - constexpr unique_ptr() noexcept : _Mypair(_Zero_then_variadic_args_t()) {} + constexpr unique_ptr() noexcept : _Mypair(_Zero_then_variadic_args_t{}) {} template > using _Enable_ctor_reset = @@ -1943,16 +1943,16 @@ public: && is_convertible_v (*)[], element_type (*)[]>)>; // TRANSITION, GH-248 template = 0, class = _Enable_ctor_reset<_Uty>> - explicit unique_ptr(_Uty _Ptr) noexcept : _Mypair(_Zero_then_variadic_args_t(), _Ptr) {} + explicit unique_ptr(_Uty _Ptr) noexcept : _Mypair(_Zero_then_variadic_args_t{}, _Ptr) {} template , int> = 0, class = _Enable_ctor_reset<_Uty>> - unique_ptr(_Uty _Ptr, const _Dx& _Dt) noexcept : _Mypair(_One_then_variadic_args_t(), _Dt, _Ptr) {} + unique_ptr(_Uty _Ptr, const _Dx& _Dt) noexcept : _Mypair(_One_then_variadic_args_t{}, _Dt, _Ptr) {} template >, is_constructible<_Dx2, _Dx2>>, int> = 0, class = _Enable_ctor_reset<_Uty>> - unique_ptr(_Uty _Ptr, _Dx&& _Dt) noexcept : _Mypair(_One_then_variadic_args_t(), _STD move(_Dt), _Ptr) {} + unique_ptr(_Uty _Ptr, _Dx&& _Dt) noexcept : _Mypair(_One_then_variadic_args_t{}, _STD move(_Dt), _Ptr) {} template , is_constructible<_Dx2, remove_reference_t<_Dx2>>>, int> = 0> @@ -1962,7 +1962,7 @@ public: template , int> = 0> #endif // _M_CEE unique_ptr(unique_ptr&& _Right) noexcept - : _Mypair(_One_then_variadic_args_t(), _STD forward<_Dx>(_Right.get_deleter()), _Right.release()) { + : _Mypair(_One_then_variadic_args_t{}, _STD forward<_Dx>(_Right.get_deleter()), _Right.release()) { } #ifndef _M_CEE // TRANSITION, VSO-1006185 @@ -1987,7 +1987,7 @@ public: class = _Enable_conversion<_Uty, _Ex, conditional_t, is_same<_Ex, _Dx>, is_convertible<_Ex, _Dx>>>> unique_ptr(unique_ptr<_Uty, _Ex>&& _Right) noexcept - : _Mypair(_One_then_variadic_args_t(), _STD forward<_Ex>(_Right.get_deleter()), _Right.release()) {} + : _Mypair(_One_then_variadic_args_t{}, _STD forward<_Ex>(_Right.get_deleter()), _Right.release()) {} template >> unique_ptr& operator=(unique_ptr<_Uty, _Ex>&& _Right) noexcept { @@ -1997,7 +1997,7 @@ public: } template = 0> - constexpr unique_ptr(nullptr_t) noexcept : _Mypair(_Zero_then_variadic_args_t()) {} + constexpr unique_ptr(nullptr_t) noexcept : _Mypair(_Zero_then_variadic_args_t{}) {} unique_ptr& operator=(nullptr_t) noexcept { reset(); diff --git a/stl/inc/regex b/stl/inc/regex index 7075d1f48fe..e3882b159bf 100644 --- a/stl/inc/regex +++ b/stl/inc/regex @@ -1823,13 +1823,13 @@ public: basic_regex() : _Rep(nullptr) {} // construct empty object explicit basic_regex(_In_z_ const _Elem* _Ptr, flag_type _Flags = regex_constants::ECMAScript) : _Rep(nullptr) { - _Reset(_Ptr, _Ptr + _RxTraits::length(_Ptr), _Flags, random_access_iterator_tag()); + _Reset(_Ptr, _Ptr + _RxTraits::length(_Ptr), _Flags, random_access_iterator_tag{}); } basic_regex(_In_reads_(_Count) const _Elem* _Ptr, size_t _Count, flag_type _Flags = regex_constants::ECMAScript) : _Rep(nullptr) { if (_Ptr) { - _Reset(_Ptr, _Ptr + _Count, _Flags, random_access_iterator_tag()); + _Reset(_Ptr, _Ptr + _Count, _Flags, random_access_iterator_tag{}); return; } @@ -1840,7 +1840,7 @@ public: explicit basic_regex( const basic_string<_Elem, _STtraits, _STalloc>& _Str, flag_type _Flags = regex_constants::ECMAScript) : _Rep(nullptr) { - _Reset(_Str.data(), _Str.data() + static_cast(_Str.size()), _Flags, random_access_iterator_tag()); + _Reset(_Str.data(), _Str.data() + static_cast(_Str.size()), _Flags, random_access_iterator_tag{}); } template @@ -1866,7 +1866,7 @@ public: } basic_regex(initializer_list<_Elem> _Ilist, flag_type _Flags = regex_constants::ECMAScript) : _Rep(nullptr) { - _Reset(_Ilist.begin(), _Ilist.end(), _Flags, random_access_iterator_tag()); + _Reset(_Ilist.begin(), _Ilist.end(), _Flags, random_access_iterator_tag{}); } basic_regex& operator=(initializer_list<_Elem> _Ilist) { // replace with regular expression in initializer_list @@ -1875,7 +1875,7 @@ public: basic_regex& assign(initializer_list<_Elem> _Ilist, flag_type _Flags = regex_constants::ECMAScript) { // replace with regular expression in initializer_list - _Reset(_Ilist.begin(), _Ilist.end(), _Flags, random_access_iterator_tag()); + _Reset(_Ilist.begin(), _Ilist.end(), _Flags, random_access_iterator_tag{}); return *this; } @@ -1915,14 +1915,14 @@ public: } basic_regex& operator=(_In_z_ const _Elem* _Ptr) { - _Reset(_Ptr, _Ptr + _RxTraits::length(_Ptr), ECMAScript, random_access_iterator_tag()); + _Reset(_Ptr, _Ptr + _RxTraits::length(_Ptr), ECMAScript, random_access_iterator_tag{}); return *this; } template basic_regex& operator=(const basic_string<_Elem, _STtraits, _STalloc>& _Str) { _Reset( - _Str.data(), _Str.data() + static_cast(_Str.size()), ECMAScript, random_access_iterator_tag()); + _Str.data(), _Str.data() + static_cast(_Str.size()), ECMAScript, random_access_iterator_tag{}); return *this; } @@ -1949,14 +1949,14 @@ public: basic_regex& assign( _In_reads_(_Count) const _Elem* _Ptr, size_t _Count, flag_type _Flags = regex_constants::ECMAScript) { - _Reset(_Ptr, _Ptr + _Count, _Flags, random_access_iterator_tag()); + _Reset(_Ptr, _Ptr + _Count, _Flags, random_access_iterator_tag{}); return *this; } template basic_regex& assign( const basic_string<_Elem, _STtraits, _STalloc>& _Str, flag_type _Flags = regex_constants::ECMAScript) { - _Reset(_Str.data(), _Str.data() + static_cast(_Str.size()), _Flags, random_access_iterator_tag()); + _Reset(_Str.data(), _Str.data() + static_cast(_Str.size()), _Flags, random_access_iterator_tag{}); return *this; } @@ -2021,7 +2021,7 @@ private: // build regular expression from input iterators basic_string<_Iter_value_t<_InIt>> _Str(_First, _Last); - _Reset(_Str.data(), _Str.data() + static_cast(_Str.size()), _Flags, forward_iterator_tag()); + _Reset(_Str.data(), _Str.data() + static_cast(_Str.size()), _Flags, forward_iterator_tag{}); } template diff --git a/stl/inc/scoped_allocator b/stl/inc/scoped_allocator index feb10d164fa..8d3b8e323ba 100644 --- a/stl/inc/scoped_allocator +++ b/stl/inc/scoped_allocator @@ -59,7 +59,9 @@ class scoped_allocator_adaptor; template struct _Scoped_base; -struct _Secret_scoped_allocator_construct_tag {}; +struct _Secret_scoped_allocator_construct_tag { + explicit _Secret_scoped_allocator_construct_tag() = default; +}; template struct _Scoped_base<_Outer, _Inner0, _Inner...> : _Outer { // nest of allocators, arbitrary depth diff --git a/stl/inc/tuple b/stl/inc/tuple index 2737460aca0..073dafa9511 100644 --- a/stl/inc/tuple +++ b/stl/inc/tuple @@ -182,13 +182,21 @@ struct _Tuple_val { // stores each value in a tuple }; // CLASS TEMPLATE tuple -struct _Exact_args_t {}; // tag type to disambiguate construction (from one arg per element) +struct _Exact_args_t { + explicit _Exact_args_t() = default; +}; // tag type to disambiguate construction (from one arg per element) -struct _Unpack_tuple_t {}; // tag type to disambiguate construction (from unpacking a tuple/pair) +struct _Unpack_tuple_t { + explicit _Unpack_tuple_t() = default; +}; // tag type to disambiguate construction (from unpacking a tuple/pair) -struct _Alloc_exact_args_t {}; // tag type to disambiguate construction (from an allocator and one arg per element) +struct _Alloc_exact_args_t { + explicit _Alloc_exact_args_t() = default; +}; // tag type to disambiguate construction (from an allocator and one arg per element) -struct _Alloc_unpack_tuple_t {}; // tag type to disambiguate construction (from an allocator and unpacking a tuple/pair) +struct _Alloc_unpack_tuple_t { + explicit _Alloc_unpack_tuple_t() = default; +}; // tag type to disambiguate construction (from an allocator and unpacking a tuple/pair) template class tuple; diff --git a/stl/inc/type_traits b/stl/inc/type_traits index 010e44a38d5..973aedab004 100644 --- a/stl/inc/type_traits +++ b/stl/inc/type_traits @@ -1621,7 +1621,9 @@ _IMPLEMENT_INVOKE(_C_, constexpr) template > struct _Invoker_ret {}; // helper to give INVOKE an explicit return type; avoids undesirable Expression SFINAE -struct _Unforced {}; // tag to distinguish bind() from bind() +struct _Unforced { + explicit _Unforced() = default; +}; // tag to distinguish bind() from bind() template struct _Invoker_ret<_Cv_void, true> { // selected for _Rx being cv void diff --git a/stl/inc/vector b/stl/inc/vector index f6e7de4f588..f558d63ed77 100644 --- a/stl/inc/vector +++ b/stl/inc/vector @@ -357,6 +357,7 @@ struct _Vec_iter_types { // STRUCT _Value_init_tag struct _Value_init_tag { // tag to request value-initialization + explicit _Value_init_tag() = default; }; // CLASS TEMPLATE _Vector_val @@ -441,11 +442,11 @@ public: using reverse_iterator = _STD reverse_iterator; using const_reverse_iterator = _STD reverse_iterator; - vector() noexcept(is_nothrow_default_constructible_v<_Alty>) : _Mypair(_Zero_then_variadic_args_t()) { + vector() noexcept(is_nothrow_default_constructible_v<_Alty>) : _Mypair(_Zero_then_variadic_args_t{}) { _Mypair._Myval2._Alloc_proxy(_GET_PROXY_ALLOCATOR(_Alty, _Getal())); } - explicit vector(const _Alloc& _Al) noexcept : _Mypair(_One_then_variadic_args_t(), _Al) { + explicit vector(const _Alloc& _Al) noexcept : _Mypair(_One_then_variadic_args_t{}, _Al) { _Mypair._Myval2._Alloc_proxy(_GET_PROXY_ALLOCATOR(_Alty, _Getal())); } @@ -467,12 +468,12 @@ private: public: explicit vector(_CRT_GUARDOVERFLOW const size_type _Count, const _Alloc& _Al = _Alloc()) - : _Mypair(_One_then_variadic_args_t(), _Al) { + : _Mypair(_One_then_variadic_args_t{}, _Al) { _Construct_n_copies_of_ty(_Count, _Value_init_tag{}); } vector(_CRT_GUARDOVERFLOW const size_type _Count, const _Ty& _Val, const _Alloc& _Al = _Alloc()) - : _Mypair(_One_then_variadic_args_t(), _Al) { + : _Mypair(_One_then_variadic_args_t{}, _Al) { _Construct_n_copies_of_ty(_Count, _Val); } @@ -501,7 +502,7 @@ private: public: template , int> = 0> - vector(_Iter _First, _Iter _Last, const _Alloc& _Al = _Alloc()) : _Mypair(_One_then_variadic_args_t(), _Al) { + vector(_Iter _First, _Iter _Last, const _Alloc& _Al = _Alloc()) : _Mypair(_One_then_variadic_args_t{}, _Al) { auto&& _Alproxy = _GET_PROXY_ALLOCATOR(_Alty, _Getal()); _Container_proxy_ptr<_Alty> _Proxy(_Alproxy, _Mypair._Myval2); _Adl_verify_range(_First, _Last); @@ -509,7 +510,7 @@ public: _Proxy._Release(); } - vector(initializer_list<_Ty> _Ilist, const _Alloc& _Al = _Alloc()) : _Mypair(_One_then_variadic_args_t(), _Al) { + vector(initializer_list<_Ty> _Ilist, const _Alloc& _Al = _Alloc()) : _Mypair(_One_then_variadic_args_t{}, _Al) { auto&& _Alproxy = _GET_PROXY_ALLOCATOR(_Alty, _Getal()); _Container_proxy_ptr<_Alty> _Proxy(_Alproxy, _Mypair._Myval2); _Range_construct_or_tidy(_Ilist.begin(), _Ilist.end(), random_access_iterator_tag{}); @@ -517,7 +518,7 @@ public: } vector(const vector& _Right) - : _Mypair(_One_then_variadic_args_t(), _Alty_traits::select_on_container_copy_construction(_Right._Getal())) { + : _Mypair(_One_then_variadic_args_t{}, _Alty_traits::select_on_container_copy_construction(_Right._Getal())) { auto&& _Alproxy = _GET_PROXY_ALLOCATOR(_Alty, _Getal()); auto& _My_data = _Mypair._Myval2; const auto& _Right_data = _Right._Mypair._Myval2; @@ -534,7 +535,7 @@ public: _Proxy._Release(); } - vector(const vector& _Right, const _Alloc& _Al) : _Mypair(_One_then_variadic_args_t(), _Al) { + vector(const vector& _Right, const _Alloc& _Al) : _Mypair(_One_then_variadic_args_t{}, _Al) { auto&& _Alproxy = _GET_PROXY_ALLOCATOR(_Alty, _Getal()); auto& _My_data = _Mypair._Myval2; const auto& _Right_data = _Right._Mypair._Myval2; @@ -578,13 +579,13 @@ private: } public: - vector(vector&& _Right) noexcept : _Mypair(_One_then_variadic_args_t(), _STD move(_Right._Getal())) { + vector(vector&& _Right) noexcept : _Mypair(_One_then_variadic_args_t{}, _STD move(_Right._Getal())) { _Mypair._Myval2._Alloc_proxy(_GET_PROXY_ALLOCATOR(_Alty, _Getal())); _Move_construct(_Right, true_type{}); } vector(vector&& _Right, const _Alloc& _Al) noexcept(_Alty_traits::is_always_equal::value) // strengthened - : _Mypair(_One_then_variadic_args_t(), _Al) { + : _Mypair(_One_then_variadic_args_t{}, _Al) { auto&& _Alproxy = _GET_PROXY_ALLOCATOR(_Alty, _Getal()); _Container_proxy_ptr<_Alty> _Proxy(_Alproxy, _Mypair._Myval2); _Move_construct(_Right, typename _Alty_traits::is_always_equal::type{}); diff --git a/stl/inc/xmemory b/stl/inc/xmemory index e4ef91cb23f..47690ee446a 100644 --- a/stl/inc/xmemory +++ b/stl/inc/xmemory @@ -1241,8 +1241,9 @@ using _Iterator_base = _Iterator_base12; // ALIAS TEMPLATE _Container_proxy_ptr AND SUPPORTING MACHINERY -struct _Leave_proxy_unbound {}; // tag to indicate that a proxy is being allocated before it is safe to bind to a - // _Container_base12 +struct _Leave_proxy_unbound { + explicit _Leave_proxy_unbound() = default; +}; // tag to indicate that a proxy is being allocated before it is safe to bind to a _Container_base12 struct _Fake_proxy_ptr_impl { // fake replacement for a container proxy smart pointer when no container proxy is in use _Fake_proxy_ptr_impl(const _Fake_proxy_ptr_impl&) = delete; @@ -1310,9 +1311,12 @@ using _Container_proxy_ptr = _Container_proxy_ptr12<_Rebind_alloc_t<_Alloc, _Con #endif // _ITERATOR_DEBUG_LEVEL == 0 // CLASS TEMPLATE _Compressed_pair -struct _Zero_then_variadic_args_t {}; // tag type for value-initializing first, constructing second from remaining args +struct _Zero_then_variadic_args_t { + explicit _Zero_then_variadic_args_t() = default; +}; // tag type for value-initializing first, constructing second from remaining args struct _One_then_variadic_args_t { + explicit _One_then_variadic_args_t() = default; }; // tag type for constructing first from one arg, constructing second from remaining args template && !is_final_v<_Ty1>> @@ -1366,7 +1370,9 @@ public: } }; -struct _Move_allocator_tag {}; +struct _Move_allocator_tag { + explicit _Move_allocator_tag() = default; +}; // FUNCTION TEMPLATE _Get_temporary_buffer template diff --git a/stl/inc/xstring b/stl/inc/xstring index 169f0ddbd4a..1de6dbe0182 100644 --- a/stl/inc/xstring +++ b/stl/inc/xstring @@ -2273,32 +2273,32 @@ private: public: basic_string(const basic_string& _Right) - : _Mypair(_One_then_variadic_args_t(), _Alty_traits::select_on_container_copy_construction(_Right._Getal())) { + : _Mypair(_One_then_variadic_args_t{}, _Alty_traits::select_on_container_copy_construction(_Right._Getal())) { auto&& _Alproxy = _GET_PROXY_ALLOCATOR(_Alty, _Getal()); _Container_proxy_ptr<_Alty> _Proxy(_Alproxy, _Mypair._Myval2); _Construct_lv_contents(_Right); _Proxy._Release(); } - basic_string(const basic_string& _Right, const _Alloc& _Al) : _Mypair(_One_then_variadic_args_t(), _Al) { + basic_string(const basic_string& _Right, const _Alloc& _Al) : _Mypair(_One_then_variadic_args_t{}, _Al) { auto&& _Alproxy = _GET_PROXY_ALLOCATOR(_Alty, _Getal()); _Container_proxy_ptr<_Alty> _Proxy(_Alproxy, _Mypair._Myval2); _Construct_lv_contents(_Right); _Proxy._Release(); } - basic_string() noexcept(is_nothrow_default_constructible_v<_Alty>) : _Mypair(_Zero_then_variadic_args_t()) { + basic_string() noexcept(is_nothrow_default_constructible_v<_Alty>) : _Mypair(_Zero_then_variadic_args_t{}) { _Mypair._Myval2._Alloc_proxy(_GET_PROXY_ALLOCATOR(_Alty, _Getal())); _Tidy_init(); } - explicit basic_string(const _Alloc& _Al) noexcept : _Mypair(_One_then_variadic_args_t(), _Al) { + explicit basic_string(const _Alloc& _Al) noexcept : _Mypair(_One_then_variadic_args_t{}, _Al) { _Mypair._Myval2._Alloc_proxy(_GET_PROXY_ALLOCATOR(_Alty, _Getal())); _Tidy_init(); } basic_string(const basic_string& _Right, const size_type _Roff, const _Alloc& _Al = _Alloc()) - : _Mypair(_One_then_variadic_args_t(), _Al) { // construct from _Right [_Roff, ) + : _Mypair(_One_then_variadic_args_t{}, _Al) { // construct from _Right [_Roff, ) auto&& _Alproxy = _GET_PROXY_ALLOCATOR(_Alty, _Getal()); _Container_proxy_ptr<_Alty> _Proxy(_Alproxy, _Mypair._Myval2); _Tidy_init(); @@ -2308,7 +2308,7 @@ public: basic_string( const basic_string& _Right, const size_type _Roff, const size_type _Count, const _Alloc& _Al = _Alloc()) - : _Mypair(_One_then_variadic_args_t(), _Al) { // construct from _Right [_Roff, _Roff + _Count) + : _Mypair(_One_then_variadic_args_t{}, _Al) { // construct from _Right [_Roff, _Roff + _Count) auto&& _Alproxy = _GET_PROXY_ALLOCATOR(_Alty, _Getal()); _Container_proxy_ptr<_Alty> _Proxy(_Alproxy, _Mypair._Myval2); _Tidy_init(); @@ -2317,7 +2317,7 @@ public: } basic_string(_In_reads_(_Count) const _Elem* const _Ptr, _CRT_GUARDOVERFLOW const size_type _Count) - : _Mypair(_Zero_then_variadic_args_t()) { + : _Mypair(_Zero_then_variadic_args_t{}) { auto&& _Alproxy = _GET_PROXY_ALLOCATOR(_Alty, _Getal()); _Container_proxy_ptr<_Alty> _Proxy(_Alproxy, _Mypair._Myval2); _Tidy_init(); @@ -2327,7 +2327,7 @@ public: basic_string( _In_reads_(_Count) const _Elem* const _Ptr, _CRT_GUARDOVERFLOW const size_type _Count, const _Alloc& _Al) - : _Mypair(_One_then_variadic_args_t(), _Al) { + : _Mypair(_One_then_variadic_args_t{}, _Al) { auto&& _Alproxy = _GET_PROXY_ALLOCATOR(_Alty, _Getal()); _Container_proxy_ptr<_Alty> _Proxy(_Alproxy, _Mypair._Myval2); _Tidy_init(); @@ -2335,7 +2335,7 @@ public: _Proxy._Release(); } - basic_string(_In_z_ const _Elem* const _Ptr) : _Mypair(_Zero_then_variadic_args_t()) { + basic_string(_In_z_ const _Elem* const _Ptr) : _Mypair(_Zero_then_variadic_args_t{}) { auto&& _Alproxy = _GET_PROXY_ALLOCATOR(_Alty, _Getal()); _Container_proxy_ptr<_Alty> _Proxy(_Alproxy, _Mypair._Myval2); _Tidy_init(); @@ -2346,7 +2346,7 @@ public: #if _HAS_CXX17 template ::value, int> = 0> #endif // _HAS_CXX17 - basic_string(_In_z_ const _Elem* const _Ptr, const _Alloc& _Al) : _Mypair(_One_then_variadic_args_t(), _Al) { + basic_string(_In_z_ const _Elem* const _Ptr, const _Alloc& _Al) : _Mypair(_One_then_variadic_args_t{}, _Al) { auto&& _Alproxy = _GET_PROXY_ALLOCATOR(_Alty, _Getal()); _Container_proxy_ptr<_Alty> _Proxy(_Alproxy, _Mypair._Myval2); _Tidy_init(); @@ -2354,7 +2354,7 @@ public: _Proxy._Release(); } - basic_string(_CRT_GUARDOVERFLOW const size_type _Count, const _Elem _Ch) : _Mypair(_Zero_then_variadic_args_t()) { + basic_string(_CRT_GUARDOVERFLOW const size_type _Count, const _Elem _Ch) : _Mypair(_Zero_then_variadic_args_t{}) { // construct from _Count * _Ch auto&& _Alproxy = _GET_PROXY_ALLOCATOR(_Alty, _Getal()); _Container_proxy_ptr<_Alty> _Proxy(_Alproxy, _Mypair._Myval2); @@ -2367,7 +2367,7 @@ public: template ::value, int> = 0> #endif // _HAS_CXX17 basic_string(_CRT_GUARDOVERFLOW const size_type _Count, const _Elem _Ch, const _Alloc& _Al) - : _Mypair(_One_then_variadic_args_t(), _Al) { // construct from _Count * _Ch with allocator + : _Mypair(_One_then_variadic_args_t{}, _Al) { // construct from _Count * _Ch with allocator auto&& _Alproxy = _GET_PROXY_ALLOCATOR(_Alty, _Getal()); _Container_proxy_ptr<_Alty> _Proxy(_Alproxy, _Mypair._Myval2); _Tidy_init(); @@ -2376,7 +2376,7 @@ public: } template , int> = 0> - basic_string(_Iter _First, _Iter _Last, const _Alloc& _Al = _Alloc()) : _Mypair(_One_then_variadic_args_t(), _Al) { + basic_string(_Iter _First, _Iter _Last, const _Alloc& _Al = _Alloc()) : _Mypair(_One_then_variadic_args_t{}, _Al) { auto&& _Alproxy = _GET_PROXY_ALLOCATOR(_Alty, _Getal()); _Container_proxy_ptr<_Alty> _Proxy(_Alproxy, _Mypair._Myval2); _Tidy_init(); @@ -2401,7 +2401,7 @@ public: // initialize from [_First, _Last), forward iterators const size_type _Count = _Convert_size(static_cast(_STD distance(_First, _Last))); reserve(_Count); - _Construct(_First, _Last, input_iterator_tag()); + _Construct(_First, _Last, input_iterator_tag{}); } void _Construct(_Elem* const _First, _Elem* const _Last, random_access_iterator_tag) { @@ -2418,14 +2418,14 @@ public: } } - basic_string(basic_string&& _Right) noexcept : _Mypair(_One_then_variadic_args_t(), _STD move(_Right._Getal())) { + basic_string(basic_string&& _Right) noexcept : _Mypair(_One_then_variadic_args_t{}, _STD move(_Right._Getal())) { _Mypair._Myval2._Alloc_proxy(_GET_PROXY_ALLOCATOR(_Alty, _Getal())); _Take_contents(_Right, bool_constant<_Can_memcpy_val>{}); } basic_string(basic_string&& _Right, const _Alloc& _Al) noexcept( _Alty_traits::is_always_equal::value) // strengthened - : _Mypair(_One_then_variadic_args_t(), _Al) { + : _Mypair(_One_then_variadic_args_t{}, _Al) { auto&& _Alproxy = _GET_PROXY_ALLOCATOR(_Alty, _Getal()); _Container_proxy_ptr<_Alty> _Proxy(_Alproxy, _Mypair._Myval2); if @@ -2444,7 +2444,7 @@ public: basic_string(_String_constructor_concat_tag, const basic_string& _Source_of_al, const _Elem* const _Left_ptr, const size_type _Left_size, const _Elem* const _Right_ptr, const size_type _Right_size) : _Mypair( - _One_then_variadic_args_t(), _Alty_traits::select_on_container_copy_construction(_Source_of_al._Getal())) { + _One_then_variadic_args_t{}, _Alty_traits::select_on_container_copy_construction(_Source_of_al._Getal())) { _STL_INTERNAL_CHECK(_Left_size <= max_size()); _STL_INTERNAL_CHECK(_Right_size <= max_size()); _STL_INTERNAL_CHECK(_Right_size <= max_size() - _Left_size); @@ -2470,7 +2470,7 @@ public: } basic_string(_String_constructor_concat_tag, basic_string& _Left, basic_string& _Right) - : _Mypair(_One_then_variadic_args_t(), _Left._Getal()) { + : _Mypair(_One_then_variadic_args_t{}, _Left._Getal()) { auto& _My_data = _Mypair._Myval2; auto& _Left_data = _Left._Mypair._Myval2; auto& _Right_data = _Right._Mypair._Myval2; @@ -2538,7 +2538,7 @@ public: #if _HAS_CXX17 template = 0> explicit basic_string(const _StringViewIsh& _Right, const _Alloc& _Al = _Alloc()) - : _Mypair(_One_then_variadic_args_t(), _Al) { + : _Mypair(_One_then_variadic_args_t{}, _Al) { auto&& _Alproxy = _GET_PROXY_ALLOCATOR(_Alty, _Getal()); _Container_proxy_ptr<_Alty> _Proxy(_Alproxy, _Mypair._Myval2); _Tidy_init(); @@ -2549,7 +2549,7 @@ public: template = 0> basic_string( const _StringViewIsh& _Right, const size_type _Roff, const size_type _Count, const _Alloc& _Al = _Alloc()) - : _Mypair(_One_then_variadic_args_t(), _Al) { // construct from _Right [_Roff, _Roff + _Count) using _Al + : _Mypair(_One_then_variadic_args_t{}, _Al) { // construct from _Right [_Roff, _Roff + _Count) using _Al auto&& _Alproxy = _GET_PROXY_ALLOCATOR(_Alty, _Getal()); _Container_proxy_ptr<_Alty> _Proxy(_Alproxy, _Mypair._Myval2); _Tidy_init(); @@ -2678,7 +2678,7 @@ private: public: basic_string(initializer_list<_Elem> _Ilist, const _Alloc& _Al = allocator_type()) - : _Mypair(_One_then_variadic_args_t(), _Al) { + : _Mypair(_One_then_variadic_args_t{}, _Al) { auto&& _Alproxy = _GET_PROXY_ALLOCATOR(_Alty, _Getal()); _Container_proxy_ptr<_Alty> _Proxy(_Alproxy, _Mypair._Myval2); _Tidy_init(); diff --git a/stl/inc/xtree b/stl/inc/xtree index e9c0b2d9db6..b02716be0bc 100644 --- a/stl/inc/xtree +++ b/stl/inc/xtree @@ -874,34 +874,39 @@ public: using reverse_iterator = _STD reverse_iterator; using const_reverse_iterator = _STD reverse_iterator; - struct _Copy_tag {}; - struct _Move_tag {}; + struct _Copy_tag { + explicit _Copy_tag() = default; + }; + + struct _Move_tag { + explicit _Move_tag() = default; + }; - _Tree(const key_compare& _Parg) : _Mypair(_One_then_variadic_args_t(), _Parg, _Zero_then_variadic_args_t()) { + _Tree(const key_compare& _Parg) : _Mypair(_One_then_variadic_args_t{}, _Parg, _Zero_then_variadic_args_t{}) { _Alloc_sentinel_and_proxy(); } _Tree(const key_compare& _Parg, const allocator_type& _Al) - : _Mypair(_One_then_variadic_args_t(), _Parg, _One_then_variadic_args_t(), _Al) { + : _Mypair(_One_then_variadic_args_t{}, _Parg, _One_then_variadic_args_t{}, _Al) { _Alloc_sentinel_and_proxy(); } template _Tree(const _Tree& _Right, _Any_alloc&& _Al) - : _Mypair(_One_then_variadic_args_t(), _Right.key_comp(), _One_then_variadic_args_t(), + : _Mypair(_One_then_variadic_args_t{}, _Right.key_comp(), _One_then_variadic_args_t{}, _STD forward<_Any_alloc>(_Al)) { auto&& _Alproxy = _GET_PROXY_ALLOCATOR(_Alnode, _Getal()); const auto _Scary = _Get_scary(); _Container_proxy_ptr<_Alty> _Proxy(_Alproxy, *_Scary); _Tree_head_scoped_ptr<_Alnode, _Scary_val> _Sentinel(_Getal(), *_Scary); - _Copy(_Right, _Copy_tag()); + _Copy(_Right, _Copy_tag{}); _Sentinel._Release(); _Proxy._Release(); } _Tree(_Tree&& _Right) : _Mypair( - _One_then_variadic_args_t(), _Right.key_comp(), _One_then_variadic_args_t(), _STD move(_Right._Getal())) { + _One_then_variadic_args_t{}, _Right.key_comp(), _One_then_variadic_args_t{}, _STD move(_Right._Getal())) { _Alloc_sentinel_and_proxy(); _Swap_val(_Right); } @@ -913,14 +918,14 @@ private: const auto _Scary = _Get_scary(); _Container_proxy_ptr<_Alty> _Proxy(_Alproxy, *_Scary); _Tree_head_scoped_ptr<_Alnode, _Scary_val> _Sentinel(_Getal(), *_Scary); - _Copy(_Right, _Move_tag()); + _Copy(_Right, _Move_tag{}); _Sentinel._Release(); _Proxy._Release(); } public: _Tree(_Tree&& _Right, const allocator_type& _Al) - : _Mypair(_One_then_variadic_args_t(), _Right.key_comp(), _One_then_variadic_args_t(), _Al) { + : _Mypair(_One_then_variadic_args_t{}, _Right.key_comp(), _One_then_variadic_args_t{}, _Al) { if _CONSTEXPR_IF(!_Alnode_traits::is_always_equal::value) { if (_Getal() != _Right._Getal()) { @@ -969,7 +974,7 @@ private: } else { clear(); _Getcomp() = _Right._Getcomp(); - _Copy(_Right, _Move_tag()); + _Copy(_Right, _Move_tag{}); } } @@ -1198,7 +1203,7 @@ private: clear(); _Getcomp() = _Right._Getcomp(); _Pocca(_Getal(), _Right._Getal()); - _Copy(_Right, _Copy_tag()); + _Copy(_Right, _Copy_tag{}); } void _Copy_assign(const _Tree& _Right, true_type) { @@ -1220,7 +1225,7 @@ private: _Scary->_Myhead = _Newhead; _Proxy._Bind(_Alproxy, _Scary); _Getcomp() = _Right._Getcomp(); - _Copy(_Right, _Copy_tag()); + _Copy(_Right, _Copy_tag{}); } } diff --git a/stl/inc/xutility b/stl/inc/xutility index 2ad68ddc4e6..56e1c0f53fd 100644 --- a/stl/inc/xutility +++ b/stl/inc/xutility @@ -1463,10 +1463,12 @@ constexpr void _Debug_order_set_unchecked(_InIt _First, _InIt _Last, _Pr&& _Pred #else // ^^^ _HAS_IF_CONSTEXPR / !_HAS_IF_CONSTEXPR vvv template struct _Priority_tag : _Priority_tag<_Value - 1> { // priority tag for tag dispatch + explicit _Priority_tag() = default; }; template <> struct _Priority_tag<0> { // base case priority tag for tag dispatch + explicit _Priority_tag() = default; }; template @@ -2695,7 +2697,9 @@ namespace ranges { // objects from this type to remove some typical object-ish behaviors which helps users avoid depending on their // non-specified object-ness. - struct _Construct_tag {}; + struct _Construct_tag { + explicit _Construct_tag() = default; + }; _Not_quite_object() = delete; @@ -4539,7 +4543,9 @@ struct _Lex_compare_check_element_types_helper : true_type { #endif // _HAS_STD_BYTE template -struct _Lex_compare_optimize {}; // optimization tag for lexicographical_compare +struct _Lex_compare_optimize { + explicit _Lex_compare_optimize() = default; +}; // optimization tag for lexicographical_compare template using _Lex_compare_check_element_types = _Lex_compare_optimize>; // checks the lex_compare element types for memcmp safety template -constexpr _Lex_compare_optimize _Lex_compare_memcmp_classify(const _InIt1&, const _InIt2&, const _Pr&) { +constexpr auto _Lex_compare_memcmp_classify(const _InIt1&, const _InIt2&, const _Pr&) { // return lex_compare optimization category for arbitrary iterators - return {}; + return _Lex_compare_optimize{}; } template -constexpr _Lex_compare_check_element_types, _Obj1, _Obj2, _FTy> _Lex_compare_memcmp_classify( - _Obj1* const&, _Obj2* const&, const less<_FTy>&) { +constexpr auto _Lex_compare_memcmp_classify(_Obj1* const&, _Obj2* const&, const less<_FTy>&) { // return lex_compare optimization category for pointer iterators and less<_FTy> - return {}; + return _Lex_compare_check_element_types, _Obj1, _Obj2, _FTy>{}; } template -constexpr _Lex_compare_check_element_types, _Obj1, _Obj2, _FTy> _Lex_compare_memcmp_classify( - _Obj1* const&, _Obj2* const&, const greater<_FTy>&) { +constexpr auto _Lex_compare_memcmp_classify(_Obj1* const&, _Obj2* const&, const greater<_FTy>&) { // return lex_compare optimization category for pointer iterators and greater<_FTy> - return {}; + return _Lex_compare_check_element_types, _Obj1, _Obj2, _FTy>{}; } template diff --git a/stl/src/memory_resource.cpp b/stl/src/memory_resource.cpp index 04eec84b313..25f7d99334f 100644 --- a/stl/src/memory_resource.cpp +++ b/stl/src/memory_resource.cpp @@ -8,7 +8,7 @@ _STD_BEGIN namespace pmr { - static memory_resource* _Default_resource = nullptr; + static memory_resource* _Default_resource{nullptr}; extern "C" _CRT_SATELLITE_1 _Aligned_new_delete_resource_impl* __cdecl _Aligned_new_delete_resource() noexcept { return &_Immortalize<_Aligned_new_delete_resource_impl>(); diff --git a/stl/src/xsinh.cpp b/stl/src/xsinh.cpp index 1b3b3004344..91a70a7e74f 100644 --- a/stl/src/xsinh.cpp +++ b/stl/src/xsinh.cpp @@ -8,7 +8,7 @@ _EXTERN_C_UNLESS_PURE // coefficients -static const double p[] = {0.0000000001632881, 0.0000000250483893, 0.0000027557344615, 0.0001984126975233, +static constexpr double p[] = {0.0000000001632881, 0.0000000250483893, 0.0000027557344615, 0.0001984126975233, 0.0083333333334816, 0.1666666666666574, 1.0000000000000001}; static constexpr size_t NP = sizeof(p) / sizeof(p[0]) - 1;