File tree Expand file tree Collapse file tree 1 file changed +5
-9
lines changed Expand file tree Collapse file tree 1 file changed +5
-9
lines changed Original file line number Diff line number Diff line change @@ -949,21 +949,17 @@ _CONSTEXPR20 void _Destroy_range(_NoThrowFwdIt _First, const _NoThrowSentinel _L
949
949
}
950
950
951
951
template <class _Size_type>
952
- _NODISCARD constexpr _Size_type _Convert_size(const size_t _Len) noexcept {
952
+ _NODISCARD constexpr _Size_type _Convert_size(const size_t _Len) noexcept(is_same_v<_Size_type, size_t>) {
953
953
// convert size_t to _Size_type, avoiding truncation
954
- if (_Len > (numeric_limits<_Size_type>::max) ()) {
955
- _Xlength_error("size_t too long for _Size_type");
954
+ if constexpr (!is_same_v<_Size_type, size_t>) {
955
+ if (_Len > (numeric_limits<_Size_type>::max) ()) {
956
+ _Xlength_error("size_t too long for _Size_type");
957
+ }
956
958
}
957
959
958
960
return static_cast<_Size_type>(_Len);
959
961
}
960
962
961
- template <>
962
- _NODISCARD constexpr size_t _Convert_size<size_t>(const size_t _Len) noexcept {
963
- // convert size_t to size_t, unchanged
964
- return _Len;
965
- }
966
-
967
963
template <class _Alloc>
968
964
_CONSTEXPR20 void _Deallocate_plain(_Alloc& _Al, typename _Alloc::value_type* const _Ptr) noexcept {
969
965
// deallocate a plain pointer using an allocator
You can’t perform that action at this time.
0 commit comments