Skip to content

Commit

Permalink
STYLE: In-class default-member-initialization in Command derived classes
Browse files Browse the repository at this point in the history
Using `nullptr` as default-member-initializer of all their data members.
Also defaulted their default-constructors.

Following C++ Core Guidelines, September 23, 2022, "Prefer in-class initializers
to member initializers in constructors for constant initializers",
https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Rc-in-class-initializer
  • Loading branch information
N-Dekker committed Dec 23, 2022
1 parent 542ae7b commit 76dad9f
Showing 1 changed file with 13 additions and 26 deletions.
39 changes: 13 additions & 26 deletions Modules/Core/Common/include/itkCommand.h
Expand Up @@ -139,15 +139,11 @@ class ITK_TEMPLATE_EXPORT MemberCommand : public Command
}

protected:
T * m_This;
TMemberFunctionPointer m_MemberFunction;
TConstMemberFunctionPointer m_ConstMemberFunction;
T * m_This{ nullptr };
TMemberFunctionPointer m_MemberFunction{ nullptr };
TConstMemberFunctionPointer m_ConstMemberFunction{ nullptr };

MemberCommand()
: m_This(nullptr)
, m_MemberFunction(nullptr)
, m_ConstMemberFunction(nullptr)
{}
MemberCommand() = default;

~MemberCommand() override = default;
};
Expand Down Expand Up @@ -210,13 +206,10 @@ class ITK_TEMPLATE_EXPORT ReceptorMemberCommand : public Command
}

protected:
T * m_This;
TMemberFunctionPointer m_MemberFunction;
T * m_This{ nullptr };
TMemberFunctionPointer m_MemberFunction{ nullptr };

ReceptorMemberCommand()
: m_This(nullptr)
, m_MemberFunction(nullptr)
{}
ReceptorMemberCommand() = default;

~ReceptorMemberCommand() override = default;
};
Expand Down Expand Up @@ -277,13 +270,10 @@ class ITK_TEMPLATE_EXPORT SimpleMemberCommand : public Command
}

protected:
T * m_This;
TMemberFunctionPointer m_MemberFunction;
T * m_This{ nullptr };
TMemberFunctionPointer m_MemberFunction{ nullptr };

SimpleMemberCommand()
: m_This(nullptr)
, m_MemberFunction(nullptr)
{}
SimpleMemberCommand() = default;

~SimpleMemberCommand() override = default;
};
Expand Down Expand Up @@ -344,13 +334,10 @@ class ITK_TEMPLATE_EXPORT SimpleConstMemberCommand : public Command
}

protected:
const T * m_This;
TMemberFunctionPointer m_MemberFunction;
const T * m_This{ nullptr };
TMemberFunctionPointer m_MemberFunction{ nullptr };

SimpleConstMemberCommand()
: m_This(nullptr)
, m_MemberFunction(nullptr)
{}
SimpleConstMemberCommand() = default;

~SimpleConstMemberCommand() override = default;
};
Expand Down

0 comments on commit 76dad9f

Please sign in to comment.