Skip to content
Merged
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
b0573ef
Update _MSVC_STL_UPDATE value to February 2020
JeanPhilippeKernel Feb 6, 2020
7e5b7b3
Updated macro constants to constexpr variables #270
JeanPhilippeKernel Feb 6, 2020
59b9474
Revert "Updated macro constants to constexpr variables #270"
JeanPhilippeKernel Feb 6, 2020
91167a0
Changed macro constants to constexpr variables #270
JeanPhilippeKernel Feb 6, 2020
44604c6
Merge branch 'master' of https://github.com/microsoft/STL into fix-ma…
JeanPhilippeKernel Feb 6, 2020
eecf828
updated variables to _Ugly naming convention
JeanPhilippeKernel Feb 7, 2020
c403c18
Update stl/src/xtime.cpp
JeanPhilippeKernel Feb 7, 2020
8551ae8
updated macro change
JeanPhilippeKernel Feb 7, 2020
fd3f8e8
removed unecesarry comment
JeanPhilippeKernel Feb 7, 2020
0dfcf9f
Merge branch 'master' of https://github.com/microsoft/STL into fix-ma…
JeanPhilippeKernel Feb 7, 2020
bde3b36
clang-format updated
JeanPhilippeKernel Feb 7, 2020
e483f6a
removed unnecessary parentheses
JeanPhilippeKernel Feb 7, 2020
1eee336
Update comments.
StephanTLavavej Feb 7, 2020
72c9caa
Merge branch 'master' of https://github.com/microsoft/STL into fix-ma…
JeanPhilippeKernel Feb 8, 2020
8c2e1b2
update tag
JeanPhilippeKernel Feb 12, 2020
71d78c2
Consistently use empty braces to construct tags like _Meow{} (#468)
JeanPhilippeKernel Feb 12, 2020
0f890ba
revert change
JeanPhilippeKernel Feb 12, 2020
f4aa09f
fix clang-format for vector and xmemory
JeanPhilippeKernel Feb 12, 2020
102c248
Revert "fix clang-format for vector and xmemory" and re-update files …
JeanPhilippeKernel Feb 12, 2020
3e1903b
update files
JeanPhilippeKernel Feb 12, 2020
f51241b
Files revision to apply _INLINE_VAR constexpr convention,
JeanPhilippeKernel Feb 13, 2020
4690500
Fix compiler errors.
StephanTLavavej Feb 29, 2020
f8b03b5
Replace more `_LITTLE_FIRST` and `_BIG_FIRST`.
StephanTLavavej Feb 29, 2020
4ae0835
Within stdext::cvt, use _STD qualification.
StephanTLavavej Feb 29, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions stl/inc/codecvt
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ _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
constexpr int _Little_first = 1;
constexpr int _Big_first = 2;
constexpr int _Bytes_per_word = 4;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In stl/inc headers, we conventionally say _INLINE_VAR constexpr, for example:

_INLINE_VAR constexpr int _ISORT_MAX = 32; // maximum size for insertion sort

This expands to inline constexpr in C++17 mode, which makes a difference if the constant is ever address-taken (hopefully not for these constants, but we follow the convention anyways).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_BYTES_PER_WORD appears to have been completely unused and should be eliminated.


enum _CXX17_DEPRECATE_CODECVT_HEADER codecvt_mode { consume_header = 4, generate_header = 2, little_endian = 1 };

Expand Down Expand Up @@ -249,13 +249,13 @@ protected:
unsigned short _Ch0;
unsigned short _Ch1;

if (*_Pstate == _LITTLE_FIRST) {
if (*_Pstate == _Little_first) {
_Ch0 = static_cast<unsigned short>(_Ptr[1] << 8 | _Ptr[0]);
} else if (*_Pstate == _BIG_FIRST) {
} else if (*_Pstate == _Big_first) {
_Ch0 = static_cast<unsigned short>(_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) {
Expand Down Expand Up @@ -293,7 +293,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<unsigned short>(_Ptr[3] << 8 | _Ptr[2]);
} else {
_Ch1 = static_cast<unsigned short>(_Ptr[2] << 8 | _Ptr[3]);
Expand Down Expand Up @@ -325,15 +325,15 @@ 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) {
if (_Last2 - _Mid2 < 3 * _Bytes_per_word) {
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
Expand Down Expand Up @@ -362,7 +362,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<unsigned short>(0xd800 | static_cast<unsigned short>(_Ch >> 10) - 0x0040);
Expand Down
24 changes: 12 additions & 12 deletions stl/inc/deque
Original file line number Diff line number Diff line change
Expand Up @@ -592,62 +592,62 @@ public:
using const_reverse_iterator = _STD reverse_iterator<const_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);
_Proxy._Release();
}

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);
_Proxy._Release();
}

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());
_Proxy._Release();
}

template <class _Iter, enable_if_t<_Is_iterator_v<_Iter>, 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);
_Proxy._Release();
}

template <class _Iter, enable_if_t<_Is_iterator_v<_Iter>, 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);
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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());
Expand Down
4 changes: 3 additions & 1 deletion stl/inc/execution
Original file line number Diff line number Diff line change
Expand Up @@ -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 <class _FwdIt1, class _FwdIt2, class _BinOp, class _Ty>
_FwdIt2 _Exclusive_scan_per_chunk(_FwdIt1 _First, const _FwdIt1 _Last, _FwdIt2 _Dest, _BinOp _Reduce_op, _Ty& _Val) {
Expand Down
24 changes: 12 additions & 12 deletions stl/inc/forward_list
Original file line number Diff line number Diff line change
Expand Up @@ -542,56 +542,56 @@ 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();
_Insert_op._Attach_after(_Mypair._Myval2._Before_head());
}

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();
_Insert_op._Attach_after(_Mypair._Myval2._Before_head());
}

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();
_Insert_op._Attach_after(_Mypair._Myval2._Before_head());
}

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();
_Insert_op._Attach_after(_Mypair._Myval2._Before_head());
}

template <class _Iter, enable_if_t<_Is_iterator_v<_Iter>, 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));
Expand All @@ -600,7 +600,7 @@ public:
}

template <class _Iter, enable_if_t<_Is_iterator_v<_Iter>, 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));
Expand All @@ -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()) {
Expand Down Expand Up @@ -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());
Expand Down
8 changes: 5 additions & 3 deletions stl/inc/functional
Original file line number Diff line number Diff line change
Expand Up @@ -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 _Decayed>
class _Not_fn : private _Ebco_base<_Decayed> {
Expand Down Expand Up @@ -818,7 +820,7 @@ public:

template <class _Other1, class _Other2>
_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()

Expand Down Expand Up @@ -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 <class... _Unbound> \
Expand Down
Loading