diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp index 3c7f24df6..6a155f9f4 100644 --- a/single_include/nlohmann/json.hpp +++ b/single_include/nlohmann/json.hpp @@ -17519,7 +17519,7 @@ template , // ^ ^ // it it + elements_affected - for (auto it = first; it != this->end(); ++it) + for (auto it = first; std::next(it, elements_affected) != this->end(); ++it) { it->~value_type(); // destroy but keep allocation new (&*it) value_type{std::move(*std::next(it, elements_affected))}; // "move" next element to it