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
This commit is contained in:
Hans Johnson
2019-01-14 17:09:26 -06:00
committed by Hans Johnson
parent e817e4fc25
commit e3e05c7085
8 changed files with 20 additions and 20 deletions

View File

@@ -123,7 +123,7 @@ char const* ValueIteratorBase::memberName(char const** end) const {
// //////////////////////////////////////////////////////////////////
// //////////////////////////////////////////////////////////////////
ValueConstIterator::ValueConstIterator() {}
ValueConstIterator::ValueConstIterator() = default;
ValueConstIterator::ValueConstIterator(
const Value::ObjectValues::iterator& current)
@@ -146,7 +146,7 @@ operator=(const ValueIteratorBase& other) {
// //////////////////////////////////////////////////////////////////
// //////////////////////////////////////////////////////////////////
ValueIterator::ValueIterator() {}
ValueIterator::ValueIterator() = default;
ValueIterator::ValueIterator(const Value::ObjectValues::iterator& current)
: ValueIteratorBase(current) {}
@@ -157,7 +157,7 @@ ValueIterator::ValueIterator(const ValueConstIterator& other)
}
ValueIterator::ValueIterator(const ValueIterator& other)
: ValueIteratorBase(other) {}
= default;
ValueIterator& ValueIterator::operator=(const SelfType& other) {
copy(other);