Skip to content

Commit

Permalink
fixed deprecated warnings in issue #42
Browse files Browse the repository at this point in the history
  • Loading branch information
nlohmann committed Mar 22, 2015
1 parent abc6137 commit cf829ac
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 14 deletions.
34 changes: 28 additions & 6 deletions src/json.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2072,11 +2072,22 @@ class basic_json
}
}

/// copy constructor
inline iterator(const iterator& other) noexcept
: m_object(other.m_object), m_it(other.m_it)
{}

/// copy assignment
inline iterator& operator=(const iterator& other) noexcept
inline iterator& operator=(iterator other) noexcept (
std::is_nothrow_move_constructible<pointer>::value and
std::is_nothrow_move_assignable<pointer>::value and
std::is_nothrow_move_constructible<internal_iterator<typename array_t::iterator, typename object_t::iterator>>::value
and
std::is_nothrow_move_assignable<internal_iterator<typename array_t::iterator, typename object_t::iterator>>::value
)
{
m_object = other.m_object;
m_it = other.m_it;
std::swap(m_object, other.m_object);
std::swap(m_it, other.m_it);
return *this;
}

Expand Down Expand Up @@ -2575,11 +2586,22 @@ class basic_json
}
}

/// copy constructor
inline const_iterator(const const_iterator& other) noexcept
: m_object(other.m_object), m_it(other.m_it)
{}

/// copy assignment
inline const_iterator& operator=(const const_iterator& other) noexcept
inline const_iterator& operator=(const_iterator other) noexcept(
std::is_nothrow_move_constructible<pointer>::value and
std::is_nothrow_move_assignable<pointer>::value and
std::is_nothrow_move_constructible<internal_iterator<typename array_t::const_iterator, typename object_t::const_iterator>>::value
and
std::is_nothrow_move_assignable<internal_iterator<typename array_t::const_iterator, typename object_t::const_iterator>>::value
)
{
m_object = other.m_object;
m_it = other.m_it;
std::swap(m_object, other.m_object);
std::swap(m_it, other.m_it);
return *this;
}

Expand Down
38 changes: 30 additions & 8 deletions src/json.hpp.re2c
Original file line number Diff line number Diff line change
Expand Up @@ -2072,11 +2072,22 @@ class basic_json
}
}

/// copy constructor
inline iterator(const iterator& other) noexcept
: m_object(other.m_object), m_it(other.m_it)
{}

/// copy assignment
inline iterator& operator=(const iterator& other) noexcept
{
m_object = other.m_object;
m_it = other.m_it;
inline iterator& operator=(iterator other) noexcept (
std::is_nothrow_move_constructible<pointer>::value and
std::is_nothrow_move_assignable<pointer>::value and
std::is_nothrow_move_constructible<internal_iterator<typename array_t::iterator, typename object_t::iterator>>::value
and
std::is_nothrow_move_assignable<internal_iterator<typename array_t::iterator, typename object_t::iterator>>::value
)
{
std::swap(m_object, other.m_object);
std::swap(m_it, other.m_it);
return *this;
}

Expand Down Expand Up @@ -2575,11 +2586,22 @@ class basic_json
}
}

/// copy constructor
inline const_iterator(const const_iterator& other) noexcept
: m_object(other.m_object), m_it(other.m_it)
{}

/// copy assignment
inline const_iterator& operator=(const const_iterator& other) noexcept
{
m_object = other.m_object;
m_it = other.m_it;
inline const_iterator& operator=(const_iterator other) noexcept(
std::is_nothrow_move_constructible<pointer>::value and
std::is_nothrow_move_assignable<pointer>::value and
std::is_nothrow_move_constructible<internal_iterator<typename array_t::const_iterator, typename object_t::const_iterator>>::value
and
std::is_nothrow_move_assignable<internal_iterator<typename array_t::const_iterator, typename object_t::const_iterator>>::value
)
{
std::swap(m_object, other.m_object);
std::swap(m_it, other.m_it);
return *this;
}

Expand Down

0 comments on commit cf829ac

Please sign in to comment.