diff --git a/src/json.hpp b/src/json.hpp index 9bb0d943..eae84f1d 100644 --- a/src/json.hpp +++ b/src/json.hpp @@ -1065,7 +1065,7 @@ void from_json(const BasicJsonType& j, std::forward_list& l) } template -void from_json_array_impl(const BasicJsonType& j, CompatibleArrayType& arr, priority_tag<0>) +void from_json_array_impl(const BasicJsonType& j, CompatibleArrayType& arr, priority_tag<0> /*unused*/) { using std::begin; using std::end; @@ -1080,7 +1080,7 @@ void from_json_array_impl(const BasicJsonType& j, CompatibleArrayType& arr, prio } template -auto from_json_array_impl(const BasicJsonType& j, CompatibleArrayType& arr, priority_tag<1>) +auto from_json_array_impl(const BasicJsonType& j, CompatibleArrayType& arr, priority_tag<1> /*unused*/) -> decltype( arr.reserve(std::declval()), void()) @@ -1099,7 +1099,7 @@ auto from_json_array_impl(const BasicJsonType& j, CompatibleArrayType& arr, prio } template -void from_json_array_impl(const BasicJsonType& j, std::array& arr, priority_tag<2>) +void from_json_array_impl(const BasicJsonType& j, std::array& arr, priority_tag<2> /*unused*/) { for (std::size_t i = 0; i < N; ++i) { @@ -1211,14 +1211,14 @@ struct to_json_fn { private: template - auto call(BasicJsonType& j, T&& val, priority_tag<1>) const noexcept(noexcept(to_json(j, std::forward(val)))) + auto call(BasicJsonType& j, T&& val, priority_tag<1> /*unused*/) const noexcept(noexcept(to_json(j, std::forward(val)))) -> decltype(to_json(j, std::forward(val)), void()) { return to_json(j, std::forward(val)); } template - void call(BasicJsonType&, T&&, priority_tag<0>) const noexcept + void call(BasicJsonType& /*unused*/, T&& /*unused*/, priority_tag<0> /*unused*/) const noexcept { static_assert(sizeof(BasicJsonType) == 0, "could not find to_json() method in T's namespace"); @@ -1237,7 +1237,7 @@ struct from_json_fn { private: template - auto call(const BasicJsonType& j, T& val, priority_tag<1>) const + auto call(const BasicJsonType& j, T& val, priority_tag<1> /*unused*/) const noexcept(noexcept(from_json(j, val))) -> decltype(from_json(j, val), void()) { @@ -1245,7 +1245,7 @@ struct from_json_fn } template - void call(const BasicJsonType&, T&, priority_tag<0>) const noexcept + void call(const BasicJsonType& /*unused*/, T& /*unused*/, priority_tag<0> /*unused*/) const noexcept { static_assert(sizeof(BasicJsonType) == 0, "could not find from_json() method in T's namespace"); @@ -3727,16 +3727,14 @@ https://github.com/nlohmann/json/pull/105. template struct internal_iterator { /// iterator for JSON objects - typename BasicJsonType::object_t::iterator object_iterator; + typename BasicJsonType::object_t::iterator object_iterator {}; /// iterator for JSON arrays - typename BasicJsonType::array_t::iterator array_iterator; + typename BasicJsonType::array_t::iterator array_iterator {}; /// generic iterator for all other types - primitive_iterator_t primitive_iterator; + primitive_iterator_t primitive_iterator {}; /// create an uninitialized internal_iterator - internal_iterator() noexcept - : object_iterator(), array_iterator(), primitive_iterator() - {} + internal_iterator() = default; }; template class iteration_proxy; @@ -4584,7 +4582,7 @@ template class output_vector_adapter : public output_adapter { public: - output_vector_adapter(std::vector& vec) : v(vec) {} + explicit output_vector_adapter(std::vector& vec) : v(vec) {} void write_character(CharType c) override { @@ -7408,13 +7406,11 @@ class json_pointer const std::string& t) { assert(not f.empty()); - - for (std::size_t pos = s.find(f); // find first occurrence of f - pos != std::string::npos; // make sure f was found - s.replace(pos, f.size(), t), // replace with t - pos = s.find(f, pos + t.size()) // find next occurrence of f - ) - ; + for (auto pos = s.find(f); // find first occurrence of f + pos != std::string::npos; // make sure f was found + s.replace(pos, f.size(), t), // replace with t, and + pos = s.find(f, pos + t.size())) // find next occurrence of f + {} } /// escape tilde and slash