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/reader.h b/include/json/reader.h
index 1af5cb0..ac8b7bd 100644
--- a/include/json/reader.h
+++ b/include/json/reader.h
@@ -256,7 +256,7 @@
*/
class JSON_API CharReader {
public:
- virtual ~CharReader() {}
+ virtual ~CharReader() = default;
/** \brief Read a Value from a <a HREF="http://www.json.org">JSON</a>
document.
* The document must be a UTF-8 encoded string containing the document to
@@ -282,7 +282,7 @@
class JSON_API Factory {
public:
- virtual ~Factory() {}
+ virtual ~Factory() = default;
/** \brief Allocate a CharReader via operator new().
* \throw std::exception if something goes wrong (e.g. invalid settings)
*/