From 80cf9d70656e7a24616001b07aea8a74e7439df2 Mon Sep 17 00:00:00 2001 From: Niels Lohmann Date: Sat, 16 Oct 2021 13:27:28 +0200 Subject: [PATCH] Revert invalid fix (#3082) * :rewind: revert invalid fix --- include/nlohmann/detail/output/serializer.hpp | 7 ++++--- single_include/nlohmann/json.hpp | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/include/nlohmann/detail/output/serializer.hpp b/include/nlohmann/detail/output/serializer.hpp index b9f53477a..fabb3d3b5 100644 --- a/include/nlohmann/detail/output/serializer.hpp +++ b/include/nlohmann/detail/output/serializer.hpp @@ -811,8 +811,8 @@ class serializer // erase thousands separator if (thousands_sep != '\0') { - auto* const end = std::remove(number_buffer.begin(), - number_buffer.begin() + len, thousands_sep); + // NOLINTNEXTLINE(readability-qualified-auto,llvm-qualified-auto): std::remove returns an iterator, see https://github.com/nlohmann/json/issues/3081 + const auto end = std::remove(number_buffer.begin(), number_buffer.begin() + len, thousands_sep); std::fill(end, number_buffer.end(), '\0'); JSON_ASSERT((end - number_buffer.begin()) <= len); len = (end - number_buffer.begin()); @@ -821,7 +821,8 @@ class serializer // convert decimal point to '.' if (decimal_point != '\0' && decimal_point != '.') { - auto* const dec_pos = std::find(number_buffer.begin(), number_buffer.end(), decimal_point); + // NOLINTNEXTLINE(readability-qualified-auto,llvm-qualified-auto): std::find returns an iterator, see https://github.com/nlohmann/json/issues/3081 + const auto dec_pos = std::find(number_buffer.begin(), number_buffer.end(), decimal_point); if (dec_pos != number_buffer.end()) { *dec_pos = '.'; diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp index ca4616c3c..2ea16391a 100644 --- a/single_include/nlohmann/json.hpp +++ b/single_include/nlohmann/json.hpp @@ -17235,8 +17235,8 @@ class serializer // erase thousands separator if (thousands_sep != '\0') { - auto* const end = std::remove(number_buffer.begin(), - number_buffer.begin() + len, thousands_sep); + // NOLINTNEXTLINE(readability-qualified-auto,llvm-qualified-auto): std::remove returns an iterator, see https://github.com/nlohmann/json/issues/3081 + const auto end = std::remove(number_buffer.begin(), number_buffer.begin() + len, thousands_sep); std::fill(end, number_buffer.end(), '\0'); JSON_ASSERT((end - number_buffer.begin()) <= len); len = (end - number_buffer.begin()); @@ -17245,7 +17245,8 @@ class serializer // convert decimal point to '.' if (decimal_point != '\0' && decimal_point != '.') { - auto* const dec_pos = std::find(number_buffer.begin(), number_buffer.end(), decimal_point); + // NOLINTNEXTLINE(readability-qualified-auto,llvm-qualified-auto): std::find returns an iterator, see https://github.com/nlohmann/json/issues/3081 + const auto dec_pos = std::find(number_buffer.begin(), number_buffer.end(), decimal_point); if (dec_pos != number_buffer.end()) { *dec_pos = '.';