From 67b8c21a788cbac2e2ac349c529dcc1564e0622a Mon Sep 17 00:00:00 2001 From: Xav83 Date: Fri, 20 Dec 2019 21:29:08 +0100 Subject: [PATCH] Ignores the cppcheck warnings about missing explicit keywords on constructor with one parameter in json_ref.hpp. --- include/nlohmann/detail/json_ref.hpp | 4 ++++ single_include/nlohmann/json.hpp | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/include/nlohmann/detail/json_ref.hpp b/include/nlohmann/detail/json_ref.hpp index c8dec7330..b03cb293c 100644 --- a/include/nlohmann/detail/json_ref.hpp +++ b/include/nlohmann/detail/json_ref.hpp @@ -15,14 +15,17 @@ class json_ref public: using value_type = BasicJsonType; + // cppcheck-suppress noExplicitConstructor json_ref(value_type&& value) : owned_value(std::move(value)), value_ref(&owned_value), is_rvalue(true) {} + // cppcheck-suppress noExplicitConstructor json_ref(const value_type& value) : value_ref(const_cast(&value)), is_rvalue(false) {} + // cppcheck-suppress noExplicitConstructor json_ref(std::initializer_list init) : owned_value(init), value_ref(&owned_value), is_rvalue(true) {} @@ -30,6 +33,7 @@ class json_ref template < class... Args, enable_if_t::value, int> = 0 > + // cppcheck-suppress noExplicitConstructor json_ref(Args && ... args) : owned_value(std::forward(args)...), value_ref(&owned_value), is_rvalue(true) {} diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp index fb1cf4808..53a0a929a 100644 --- a/single_include/nlohmann/json.hpp +++ b/single_include/nlohmann/json.hpp @@ -11103,14 +11103,17 @@ class json_ref public: using value_type = BasicJsonType; + // cppcheck-suppress noExplicitConstructor json_ref(value_type&& value) : owned_value(std::move(value)), value_ref(&owned_value), is_rvalue(true) {} + // cppcheck-suppress noExplicitConstructor json_ref(const value_type& value) : value_ref(const_cast(&value)), is_rvalue(false) {} + // cppcheck-suppress noExplicitConstructor json_ref(std::initializer_list init) : owned_value(init), value_ref(&owned_value), is_rvalue(true) {} @@ -11118,6 +11121,7 @@ class json_ref template < class... Args, enable_if_t::value, int> = 0 > + // cppcheck-suppress noExplicitConstructor json_ref(Args && ... args) : owned_value(std::forward(args)...), value_ref(&owned_value), is_rvalue(true) {}