From 885b1449a14d2a5d8c051bf286c39a27286f4a11 Mon Sep 17 00:00:00 2001 From: BrentVL-1952840 <70229620+Brentdevent@users.noreply.github.com> Date: Mon, 27 Feb 2023 10:52:25 +0100 Subject: [PATCH 1/3] Remove carriage return from file --- src/client/component/dvars.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/client/component/dvars.cpp b/src/client/component/dvars.cpp index 42828b02..13f35691 100644 --- a/src/client/component/dvars.cpp +++ b/src/client/component/dvars.cpp @@ -65,6 +65,8 @@ namespace dvars return; } + data.erase(std::remove(data.begin(), data.end(), '\r'), data.end()); + std::istringstream stream(data); std::string line; From 947318deac5c5ee7b7b2f4227c62a37b4f578796 Mon Sep 17 00:00:00 2001 From: BrentVL-1952840 <70229620+Brentdevent@users.noreply.github.com> Date: Mon, 27 Feb 2023 11:04:14 +0100 Subject: [PATCH 2/3] Use std::ranges::remove instead --- src/client/component/dvars.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/client/component/dvars.cpp b/src/client/component/dvars.cpp index 13f35691..382a9b7a 100644 --- a/src/client/component/dvars.cpp +++ b/src/client/component/dvars.cpp @@ -65,7 +65,7 @@ namespace dvars return; } - data.erase(std::remove(data.begin(), data.end(), '\r'), data.end()); + data.erase(std::ranges::remove(data, '\r').begin(), data.end()); std::istringstream stream(data); std::string line; From e6b0995c348d0d7fd3a391937d4eb72f5235c56b Mon Sep 17 00:00:00 2001 From: BrentVL-1952840 <70229620+Brentdevent@users.noreply.github.com> Date: Mon, 27 Feb 2023 11:17:22 +0100 Subject: [PATCH 3/3] decomposing the subrange --- src/client/component/dvars.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/client/component/dvars.cpp b/src/client/component/dvars.cpp index 382a9b7a..7fb93b2f 100644 --- a/src/client/component/dvars.cpp +++ b/src/client/component/dvars.cpp @@ -65,7 +65,8 @@ namespace dvars return; } - data.erase(std::ranges::remove(data, '\r').begin(), data.end()); + const auto [beg, end] = std::ranges::remove(data, '\r'); + data.erase(beg, end); std::istringstream stream(data); std::string line;