From 077358f5dedf9fa3c56aa438597ccc42f3b3c400 Mon Sep 17 00:00:00 2001 From: Kamath <53545471+KamathScience@users.noreply.github.com> Date: Sun, 18 Feb 2024 16:19:53 -0800 Subject: [PATCH 1/3] Add top-level const to parameters --- stl/inc/algorithm | 2 +- stl/inc/xutility | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/stl/inc/algorithm b/stl/inc/algorithm index c6c0fdfc293..fdf89595064 100644 --- a/stl/inc/algorithm +++ b/stl/inc/algorithm @@ -72,7 +72,7 @@ __declspec(noalias) _Min_max_d __stdcall __std_minmax_d(const void* _First, cons _STD_BEGIN template -_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; diff --git a/stl/inc/xutility b/stl/inc/xutility index 40d46de844d..fb2d39ab1bd 100644 --- a/stl/inc/xutility +++ b/stl/inc/xutility @@ -171,7 +171,7 @@ _Ty* __std_find_trivial(_Ty* _First, _Ty* _Last, const _TVal _Val) noexcept { } template -_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(_Val)); } else if constexpr (sizeof(_Ty) == 1) { From 17178c497af31a0b3a6362cac4935abaae1546c9 Mon Sep 17 00:00:00 2001 From: Kamath <53545471+KamathScience@users.noreply.github.com> Date: Sun, 18 Feb 2024 16:41:02 -0800 Subject: [PATCH 2/3] Add top-level const to parameters - min & max --- stl/inc/algorithm | 2 +- stl/inc/xutility | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/stl/inc/algorithm b/stl/inc/algorithm index fdf89595064..2b51b244d07 100644 --- a/stl/inc/algorithm +++ b/stl/inc/algorithm @@ -97,7 +97,7 @@ _STD pair<_Ty*, _Ty*> __std_minmax_element(_Ty* const _First, _Ty* const _Last) } template -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>) { diff --git a/stl/inc/xutility b/stl/inc/xutility index fb2d39ab1bd..b7945e6849a 100644 --- a/stl/inc/xutility +++ b/stl/inc/xutility @@ -234,7 +234,7 @@ _Ty* __std_max_element(_Ty* _First, _Ty* _Last) noexcept { } template -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>) { @@ -277,7 +277,7 @@ auto __std_min(_Ty* _First, _Ty* _Last) noexcept { } template -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>) { From f128038ecc45ba67ce92d5066885dcc98c7a6fc1 Mon Sep 17 00:00:00 2001 From: Kamath <53545471+KamathScience@users.noreply.github.com> Date: Tue, 20 Feb 2024 11:43:18 -0800 Subject: [PATCH 3/3] Add top-level const to parameters to remaning functions --- stl/inc/algorithm | 2 +- stl/inc/xutility | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/stl/inc/algorithm b/stl/inc/algorithm index 2b51b244d07..16f522c7b11 100644 --- a/stl/inc/algorithm +++ b/stl/inc/algorithm @@ -141,7 +141,7 @@ auto __std_minmax(_Ty* const _First, _Ty* const _Last) noexcept { } template -_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(_Val)); } else if constexpr (sizeof(_Ty) == 1) { diff --git a/stl/inc/xutility b/stl/inc/xutility index b7945e6849a..85cfd31351f 100644 --- a/stl/inc/xutility +++ b/stl/inc/xutility @@ -133,7 +133,7 @@ __declspec(noalias) double __stdcall __std_max_d(const void* _First, const void* _STD_BEGIN template -__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(_Val)); } else if constexpr (sizeof(_Ty) == 1) { @@ -150,7 +150,7 @@ __declspec(noalias) size_t __std_count_trivial(_Ty* _First, _Ty* _Last, const _T } template -_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(_Val)); } else if constexpr (sizeof(_Ty) == 1) { @@ -192,7 +192,7 @@ _Ty* __std_find_trivial_unsized(_Ty* const _First, const _TVal _Val) noexcept { } template -_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>) { @@ -213,7 +213,7 @@ _Ty* __std_min_element(_Ty* _First, _Ty* _Last) noexcept { } template -_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>) {