diff --git a/include/nlohmann/detail/iterators/iter_impl.hpp b/include/nlohmann/detail/iterators/iter_impl.hpp index 0b0282c2..8492c234 100644 --- a/include/nlohmann/detail/iterators/iter_impl.hpp +++ b/include/nlohmann/detail/iterators/iter_impl.hpp @@ -118,6 +118,13 @@ class iter_impl to iterator is not defined. */ + /* We had to explicitly define the copy constructor for the const + case to circumvent a bug on msvc 2015 debug build. + More info: https://github.com/nlohmann/json/issues/1608 + */ + iter_impl(const iter_impl& other) noexcept + : m_object(other.m_object), m_it(other.m_it) {} + /*! @brief converting constructor @param[in] other non-const iterator to copy from diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp index bb2dacbc..c652b35a 100644 --- a/single_include/nlohmann/json.hpp +++ b/single_include/nlohmann/json.hpp @@ -7821,6 +7821,13 @@ class iter_impl to iterator is not defined. */ + /* We had to explicitly define the copy constructor for the const + case to circumvent a bug on msvc 2015 debug build. + More info: https://github.com/nlohmann/json/issues/1608 + */ + iter_impl(const iter_impl& other) noexcept + : m_object(other.m_object), m_it(other.m_it) {} + /*! @brief converting constructor @param[in] other non-const iterator to copy from