Skip to content

Commit

Permalink
Workaround msvc2015 bug with explicit copy-constructor for const_iter…
Browse files Browse the repository at this point in the history
…ator
  • Loading branch information
nickaein committed Jun 21, 2019
1 parent bf09f78 commit 4c23af1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
7 changes: 7 additions & 0 deletions include/nlohmann/detail/iterators/iter_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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:/nlohmann/json/issues/1608
*/
iter_impl(const iter_impl<const BasicJsonType>& other) noexcept
: m_object(other.m_object), m_it(other.m_it) {}

/*!
@brief converting constructor
@param[in] other non-const iterator to copy from
Expand Down
7 changes: 7 additions & 0 deletions single_include/nlohmann/json.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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:/nlohmann/json/issues/1608
*/
iter_impl(const iter_impl<const BasicJsonType>& other) noexcept
: m_object(other.m_object), m_it(other.m_it) {}

/*!
@brief converting constructor
@param[in] other non-const iterator to copy from
Expand Down

0 comments on commit 4c23af1

Please sign in to comment.