-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Add missing size_type cast to basic_string
#5562
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
Add missing size_type cast to basic_string
#5562
Conversation
827aa18 to
1e2a465
Compare
1e2a465 to
64c1f89
Compare
| _STD _Seek_wrapped(_First, _STD remove(_STD _Get_unwrapped(_First), _STD _Get_unwrapped(_Last), _Val)); | ||
| _Cont.erase(_First, _Last); | ||
| return _Old_size - _Cont.size(); | ||
| return static_cast<typename _Container::size_type>(_Old_size - _Cont.size()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems that _Erase_remove(_if) can be C++20 (and later) -only now, which allows us to drop typename, as we've removed std::experimental::erase(_if).
|
I'm mirroring this to the MSVC-internal repo - please notify me if any further changes are pushed. |
|
Thanks for fixing so many occurrences of warnings! 🛠️ 💯 🐱 |
Towards #5546.
There're some currently problematic cases:
size_typeis narrower thanintand hence usual arithmetic conversion changes the type toint, andsize_typeis 64-bit andsize_tis 32-bit (on a 32-bit platform).Explicit cast will resolve warnings on narrowing and errors with type mismatch in
std::max/std::minin these cases.