Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use swap() by ADL #3609

Merged
merged 3 commits into from
Jul 28, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions include/nlohmann/json.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3447,7 +3447,8 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
// swap only works for arrays
if (JSON_HEDLEY_LIKELY(is_array()))
{
std::swap(*(m_value.array), other);
using std::swap;
swap(*(m_value.array), other);
falbrechtskirchinger marked this conversation as resolved.
Show resolved Hide resolved
}
else
{
Expand All @@ -3462,7 +3463,8 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
// swap only works for objects
if (JSON_HEDLEY_LIKELY(is_object()))
{
std::swap(*(m_value.object), other);
using std::swap;
swap(*(m_value.object), other);
}
else
{
Expand All @@ -3477,7 +3479,8 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
// swap only works for strings
if (JSON_HEDLEY_LIKELY(is_string()))
{
std::swap(*(m_value.string), other);
using std::swap;
swap(*(m_value.string), other);
}
else
{
Expand All @@ -3492,7 +3495,8 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
// swap only works for strings
if (JSON_HEDLEY_LIKELY(is_binary()))
{
std::swap(*(m_value.binary), other);
using std::swap;
swap(*(m_value.binary), other);
}
else
{
Expand All @@ -3507,7 +3511,8 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
// swap only works for strings
if (JSON_HEDLEY_LIKELY(is_binary()))
{
std::swap(*(m_value.binary), other);
using std::swap;
swap(*(m_value.binary), other);
}
else
{
Expand Down
15 changes: 10 additions & 5 deletions single_include/nlohmann/json.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22274,7 +22274,8 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
// swap only works for arrays
if (JSON_HEDLEY_LIKELY(is_array()))
{
std::swap(*(m_value.array), other);
using std::swap;
swap(*(m_value.array), other);
}
else
{
Expand All @@ -22289,7 +22290,8 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
// swap only works for objects
if (JSON_HEDLEY_LIKELY(is_object()))
{
std::swap(*(m_value.object), other);
using std::swap;
swap(*(m_value.object), other);
}
else
{
Expand All @@ -22304,7 +22306,8 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
// swap only works for strings
if (JSON_HEDLEY_LIKELY(is_string()))
{
std::swap(*(m_value.string), other);
using std::swap;
swap(*(m_value.string), other);
}
else
{
Expand All @@ -22319,7 +22322,8 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
// swap only works for strings
if (JSON_HEDLEY_LIKELY(is_binary()))
{
std::swap(*(m_value.binary), other);
using std::swap;
swap(*(m_value.binary), other);
}
else
{
Expand All @@ -22334,7 +22338,8 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
// swap only works for strings
if (JSON_HEDLEY_LIKELY(is_binary()))
{
std::swap(*(m_value.binary), other);
using std::swap;
swap(*(m_value.binary), other);
}
else
{
Expand Down