diff options
| author | mitaclaw <140017135+mitaclaw@users.noreply.github.com> | 2024-09-28 20:18:33 -0700 |
|---|---|---|
| committer | mitaclaw <140017135+mitaclaw@users.noreply.github.com> | 2024-10-17 18:38:34 -0700 |
| commit | be0b13da97121d9ca1b1d454cf3a36bcccb5173b (patch) | |
| tree | 90c2956e694b6ba5750f4df022b3201c3f6b0539 /Source/Android/jni/AndroidCommon/AndroidCommon.cpp | |
| parent | 4fde0f2868212afc216cd9324af8d5efcc282887 (diff) | |
Simplify `std::remove` with `std::erase`
`std::erase` is a replacement for the remove-erase idiom.
Changes to `OpenModeToAndroid` inadvertently revealed that the prior implementation had UB (potentially deleting the end iterator). This is now fixed.
Diffstat (limited to 'Source/Android/jni/AndroidCommon/AndroidCommon.cpp')
| -rw-r--r-- | Source/Android/jni/AndroidCommon/AndroidCommon.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Source/Android/jni/AndroidCommon/AndroidCommon.cpp b/Source/Android/jni/AndroidCommon/AndroidCommon.cpp index 25ec479790..a976d573b8 100644 --- a/Source/Android/jni/AndroidCommon/AndroidCommon.cpp +++ b/Source/Android/jni/AndroidCommon/AndroidCommon.cpp @@ -62,7 +62,7 @@ bool IsPathAndroidContent(std::string_view uri) std::string OpenModeToAndroid(std::string mode) { // The 'b' specifier is not supported by Android. Since we're on POSIX, it's fine to just skip it. - mode.erase(std::remove(mode.begin(), mode.end(), 'b')); + std::erase(mode, 'b'); if (mode == "r") return "r"; |
