Skip to content

Commit

Permalink
fixup! Replace string concatenations using + with concat()
Browse files Browse the repository at this point in the history
  • Loading branch information
falbrechtskirchinger committed Apr 4, 2022
1 parent 081bce9 commit 83b4a65
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
7 changes: 4 additions & 3 deletions include/nlohmann/detail/exceptions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,12 @@ class exception : public std::exception
return "";
}

return concat('(', std::accumulate(tokens.rbegin(), tokens.rend(), std::string{},
[](const std::string & a, const std::string & b)
auto str = std::accumulate(tokens.rbegin(), tokens.rend(), std::string{},
[](const std::string & a, const std::string & b)
{
return concat(a, '/', detail::escape(b));
}), ") ");
});
return concat('(', str, ") ");
#else
static_cast<void>(leaf_element);
return "";
Expand Down
7 changes: 4 additions & 3 deletions single_include/nlohmann/json.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3840,11 +3840,12 @@ class exception : public std::exception
return "";
}

return concat('(', std::accumulate(tokens.rbegin(), tokens.rend(), std::string{},
[](const std::string & a, const std::string & b)
auto str = std::accumulate(tokens.rbegin(), tokens.rend(), std::string{},
[](const std::string & a, const std::string & b)
{
return concat(a, '/', detail::escape(b));
}), ") ");
});
return concat('(', str, ") ");
#else
static_cast<void>(leaf_element);
return "";
Expand Down

0 comments on commit 83b4a65

Please sign in to comment.