Skip to content

Commit 1573c78

Browse files
frederick-vs-jastrega-nil-msStephanTLavavej
authored
<xstring>: Strengthen exception specification for sv.compare("NTBS") (#3738)
Co-authored-by: nicole mazzuca <[email protected]> Co-authored-by: Stephan T. Lavavej <[email protected]>
1 parent e37227e commit 1573c78

File tree

2 files changed

+136
-171
lines changed

2 files changed

+136
-171
lines changed

stl/inc/xstring

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1399,7 +1399,8 @@ public:
13991399
return substr(_Off, _Nx).compare(_Right.substr(_Roff, _Count));
14001400
}
14011401

1402-
_NODISCARD constexpr int compare(_In_z_ const _Elem* const _Ptr) const { // compare [0, _Mysize) with [_Ptr, <null>)
1402+
_NODISCARD constexpr int compare(_In_z_ const _Elem* const _Ptr) const noexcept /* strengthened */ {
1403+
// compare [0, _Mysize) with [_Ptr, <null>)
14031404
return compare(basic_string_view(_Ptr));
14041405
}
14051406

@@ -4270,7 +4271,7 @@ public:
42704271
_Construct_in_place(_Starts_small._Bx._Ptr, _Ptr);
42714272
}
42724273

4273-
_CONSTEXPR20 void _Swap_data(basic_string& _Right) {
4274+
_CONSTEXPR20 void _Swap_data(basic_string& _Right) noexcept {
42744275
using _STD swap;
42754276

42764277
auto& _My_data = _Mypair._Myval2;
@@ -4826,7 +4827,7 @@ private:
48264827
_My_data._Myres = _BUF_SIZE - 1;
48274828
}
48284829

4829-
_CONSTEXPR20 void _Eos(const size_type _New_size) { // set new length and null terminator
4830+
_CONSTEXPR20 void _Eos(const size_type _New_size) noexcept { // set new length and null terminator
48304831
_ASAN_STRING_MODIFY(*this, _Mypair._Myval2._Mysize, _New_size);
48314832
_Traits::assign(_Mypair._Myval2._Myptr()[_Mypair._Myval2._Mysize = _New_size], _Elem());
48324833
}
@@ -4866,7 +4867,7 @@ public:
48664867
}
48674868

48684869
private:
4869-
_CONSTEXPR20 void _Swap_proxy_and_iterators(basic_string& _Right) {
4870+
_CONSTEXPR20 void _Swap_proxy_and_iterators(basic_string& _Right) noexcept {
48704871
_Mypair._Myval2._Swap_proxy_and_iterators(_Right._Mypair._Myval2);
48714872
}
48724873

0 commit comments

Comments
 (0)