diff --git a/include/nlohmann/detail/input/json_sax.hpp b/include/nlohmann/detail/input/json_sax.hpp index 405d3612f..8b3bdeebc 100644 --- a/include/nlohmann/detail/input/json_sax.hpp +++ b/include/nlohmann/detail/input/json_sax.hpp @@ -353,9 +353,9 @@ class json_sax_dom_callback_parser using parse_event_t = typename BasicJsonType::parse_event_t; json_sax_dom_callback_parser(BasicJsonType& r, - const parser_callback_t& cb, + const parser_callback_t cb, const bool allow_exceptions_ = true) - : root(r), callback(cb), allow_exceptions(allow_exceptions_) + : root(r), callback(std::move(cb)), allow_exceptions(allow_exceptions_) { keep_stack.push_back(true); } diff --git a/include/nlohmann/detail/output/output_adapters.hpp b/include/nlohmann/detail/output/output_adapters.hpp index 4583ca00c..626f7c0c8 100644 --- a/include/nlohmann/detail/output/output_adapters.hpp +++ b/include/nlohmann/detail/output/output_adapters.hpp @@ -31,7 +31,7 @@ template struct output_adapter_protocol { virtual void write_character(CharType c) = 0; virtual void write_characters(const CharType* s, std::size_t length) = 0; - virtual ~output_adapter_protocol(); + virtual ~output_adapter_protocol() = default; output_adapter_protocol() = default; output_adapter_protocol(const output_adapter_protocol&) = default; @@ -40,10 +40,6 @@ template struct output_adapter_protocol output_adapter_protocol& operator=(output_adapter_protocol&&) noexcept = default; }; -// explicitly default the destructor to fix portability-template-virtual-member-function -template -output_adapter_protocol::~output_adapter_protocol() = default; - /// a type to simplify interfaces template using output_adapter_t = std::shared_ptr>; diff --git a/include/nlohmann/json.hpp b/include/nlohmann/json.hpp index cb362b3b5..d1195b432 100644 --- a/include/nlohmann/json.hpp +++ b/include/nlohmann/json.hpp @@ -131,7 +131,7 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec template static ::nlohmann::detail::parser parser( InputAdapterType adapter, - detail::parser_callback_tcb = nullptr, + detail::parser_callback_t& cb = nullptr, const bool allow_exceptions = true, const bool ignore_comments = false ) @@ -1029,7 +1029,7 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec template < class InputIT, typename std::enable_if < std::is_same::value || std::is_same::value, int >::type = 0 > - basic_json(InputIT first, InputIT last) + basic_json(InputIT first, InputIT last) // NOLINT(performance-unnecessary-value-param) { JSON_ASSERT(first.m_object != nullptr); JSON_ASSERT(last.m_object != nullptr); diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp index 5cfb985b7..e960e6548 100644 --- a/single_include/nlohmann/json.hpp +++ b/single_include/nlohmann/json.hpp @@ -7037,9 +7037,9 @@ class json_sax_dom_callback_parser using parse_event_t = typename BasicJsonType::parse_event_t; json_sax_dom_callback_parser(BasicJsonType& r, - const parser_callback_t& cb, + const parser_callback_t cb, const bool allow_exceptions_ = true) - : root(r), callback(cb), allow_exceptions(allow_exceptions_) + : root(r), callback(std::move(cb)), allow_exceptions(allow_exceptions_) { keep_stack.push_back(true); } @@ -14991,7 +14991,7 @@ template struct output_adapter_protocol { virtual void write_character(CharType c) = 0; virtual void write_characters(const CharType* s, std::size_t length) = 0; - virtual ~output_adapter_protocol(); + virtual ~output_adapter_protocol() = default; output_adapter_protocol() = default; output_adapter_protocol(const output_adapter_protocol&) = default; @@ -15000,10 +15000,6 @@ template struct output_adapter_protocol output_adapter_protocol& operator=(output_adapter_protocol&&) noexcept = default; }; -// explicitly default the destructor to fix portability-template-virtual-member-function -template -output_adapter_protocol::~output_adapter_protocol() = default; - /// a type to simplify interfaces template using output_adapter_t = std::shared_ptr>; @@ -19483,7 +19479,7 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec template static ::nlohmann::detail::parser parser( InputAdapterType adapter, - detail::parser_callback_tcb = nullptr, + detail::parser_callback_t& cb = nullptr, const bool allow_exceptions = true, const bool ignore_comments = false ) @@ -20381,7 +20377,7 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec template < class InputIT, typename std::enable_if < std::is_same::value || std::is_same::value, int >::type = 0 > - basic_json(InputIT first, InputIT last) + basic_json(InputIT first, InputIT last) // NOLINT(performance-unnecessary-value-param) { JSON_ASSERT(first.m_object != nullptr); JSON_ASSERT(last.m_object != nullptr);