STYLE: Pefer = default to explicitly trivial implementations
This check replaces default bodies of special member functions with
= default;. The explicitly defaulted function declarations enable more
opportunities in optimization, because the compiler might treat
explicitly defaulted functions as trivial.
Additionally, the C++11 use of = default more clearly expreses the
intent for the special member functions.
SRCDIR=/Users/johnsonhj/src/jsoncpp/ #My local SRC
BLDDIR=/Users/johnsonhj/src/jsoncpp/cmake-build-debug/ #My local BLD
cd /Users/johnsonhj/src/jsoncpp/cmake-build-debug/
run-clang-tidy.py -extra-arg=-D__clang__ -checks=-*,modernize-use-equals-default -header-filter=.* -fix
diff --git a/include/json/writer.h b/include/json/writer.h
index 1653260..10a1c8e 100644
--- a/include/json/writer.h
+++ b/include/json/writer.h
@@ -169,7 +169,7 @@
: public Writer {
public:
FastWriter();
- ~FastWriter() override {}
+ ~FastWriter() override = default;
void enableYAMLCompatibility();
@@ -229,7 +229,7 @@
StyledWriter : public Writer {
public:
StyledWriter();
- ~StyledWriter() override {}
+ ~StyledWriter() override = default;
public: // overridden from Writer
/** \brief Serialize a Value in <a HREF="http://www.json.org">JSON</a> format.