Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

<xutility>, <algorithm>: Add top level const on pointer parameters #4410

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 3 additions & 3 deletions stl/inc/algorithm
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ __declspec(noalias) _Min_max_d __stdcall __std_minmax_d(const void* _First, cons

_STD_BEGIN
template <class _Ty>
_STD pair<_Ty*, _Ty*> __std_minmax_element(_Ty* _First, _Ty* _Last) noexcept {
_STD pair<_Ty*, _Ty*> __std_minmax_element(_Ty* const _First, _Ty* const _Last) noexcept {
constexpr bool _Signed = _STD is_signed_v<_Ty>;

_Min_max_element_t _Res;
Expand All @@ -97,7 +97,7 @@ _STD pair<_Ty*, _Ty*> __std_minmax_element(_Ty* _First, _Ty* _Last) noexcept {
}

template <class _Ty>
auto __std_minmax(_Ty* _First, _Ty* _Last) noexcept {
auto __std_minmax(_Ty* const _First, _Ty* const _Last) noexcept {
constexpr bool _Signed = _STD is_signed_v<_Ty>;

if constexpr (_STD is_pointer_v<_Ty>) {
Expand Down Expand Up @@ -141,7 +141,7 @@ auto __std_minmax(_Ty* _First, _Ty* _Last) noexcept {
}

template <class _Ty, class _TVal>
_Ty* __std_find_last_trivial(_Ty* _First, _Ty* _Last, const _TVal _Val) noexcept {
_Ty* __std_find_last_trivial(_Ty* const _First, _Ty* const _Last, const _TVal _Val) noexcept {
if constexpr (_STD is_pointer_v<_TVal> || _STD is_null_pointer_v<_TVal>) {
return _STD __std_find_last_trivial(_First, _Last, reinterpret_cast<uintptr_t>(_Val));
} else if constexpr (sizeof(_Ty) == 1) {
Expand Down
14 changes: 7 additions & 7 deletions stl/inc/xutility
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ __declspec(noalias) double __stdcall __std_max_d(const void* _First, const void*

_STD_BEGIN
template <class _Ty, class _TVal>
__declspec(noalias) size_t __std_count_trivial(_Ty* _First, _Ty* _Last, const _TVal _Val) noexcept {
__declspec(noalias) size_t __std_count_trivial(_Ty* const _First, _Ty* const _Last, const _TVal _Val) noexcept {
if constexpr (_STD is_pointer_v<_TVal> || _STD is_null_pointer_v<_TVal>) {
return _STD __std_count_trivial(_First, _Last, reinterpret_cast<uintptr_t>(_Val));
} else if constexpr (sizeof(_Ty) == 1) {
Expand All @@ -150,7 +150,7 @@ __declspec(noalias) size_t __std_count_trivial(_Ty* _First, _Ty* _Last, const _T
}

template <class _Ty, class _TVal>
_Ty* __std_find_trivial(_Ty* _First, _Ty* _Last, const _TVal _Val) noexcept {
_Ty* __std_find_trivial(_Ty* const _First, _Ty* const _Last, const _TVal _Val) noexcept {
if constexpr (_STD is_pointer_v<_TVal> || _STD is_null_pointer_v<_TVal>) {
return _STD __std_find_trivial(_First, _Last, reinterpret_cast<uintptr_t>(_Val));
} else if constexpr (sizeof(_Ty) == 1) {
Expand All @@ -171,7 +171,7 @@ _Ty* __std_find_trivial(_Ty* _First, _Ty* _Last, const _TVal _Val) noexcept {
}

template <class _Ty, class _TVal>
_Ty* __std_find_trivial_unsized(_Ty* _First, const _TVal _Val) noexcept {
_Ty* __std_find_trivial_unsized(_Ty* const _First, const _TVal _Val) noexcept {
if constexpr (_STD is_pointer_v<_TVal> || _STD is_null_pointer_v<_TVal>) {
return _STD __std_find_trivial_unsized(_First, reinterpret_cast<uintptr_t>(_Val));
} else if constexpr (sizeof(_Ty) == 1) {
Expand All @@ -192,7 +192,7 @@ _Ty* __std_find_trivial_unsized(_Ty* _First, const _TVal _Val) noexcept {
}

template <class _Ty>
_Ty* __std_min_element(_Ty* _First, _Ty* _Last) noexcept {
_Ty* __std_min_element(_Ty* const _First, _Ty* const _Last) noexcept {
constexpr bool _Signed = _STD is_signed_v<_Ty>;

if constexpr (_STD is_same_v<_STD remove_const_t<_Ty>, float>) {
Expand All @@ -213,7 +213,7 @@ _Ty* __std_min_element(_Ty* _First, _Ty* _Last) noexcept {
}

template <class _Ty>
_Ty* __std_max_element(_Ty* _First, _Ty* _Last) noexcept {
_Ty* __std_max_element(_Ty* const _First, _Ty* const _Last) noexcept {
constexpr bool _Signed = _STD is_signed_v<_Ty>;

if constexpr (_STD is_same_v<_STD remove_const_t<_Ty>, float>) {
Expand All @@ -234,7 +234,7 @@ _Ty* __std_max_element(_Ty* _First, _Ty* _Last) noexcept {
}

template <class _Ty>
auto __std_min(_Ty* _First, _Ty* _Last) noexcept {
auto __std_min(_Ty* const _First, _Ty* const _Last) noexcept {
constexpr bool _Signed = _STD is_signed_v<_Ty>;

if constexpr (_STD is_pointer_v<_Ty>) {
Expand Down Expand Up @@ -277,7 +277,7 @@ auto __std_min(_Ty* _First, _Ty* _Last) noexcept {
}

template <class _Ty>
auto __std_max(_Ty* _First, _Ty* _Last) noexcept {
auto __std_max(_Ty* const _First, _Ty* const _Last) noexcept {
constexpr bool _Signed = _STD is_signed_v<_Ty>;

if constexpr (_STD is_pointer_v<_Ty>) {
Expand Down
Loading