-
Notifications
You must be signed in to change notification settings - Fork 217
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix coverity hits in Classifier, Decision Forest and GBT #3001
Conversation
/intelci: run |
@@ -99,6 +99,7 @@ class DAAL_EXPORT InputIface : public daal::algorithms::Input | |||
public: | |||
InputIface(size_t nElements); | |||
InputIface(const InputIface & other) : daal::algorithms::Input(other) {} | |||
InputIface & operator=(const InputIface & other) = default; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we also add daal::algorithms::Input(other) as in copy-constructor?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Default compiler-generated implementation should do this. No need to implement this manually.
I've unified all this kind of copy constructors and assignment operators in this PR to have definitions in .h and default implementations in .cpp files.
/intelci: run |
@@ -38,6 +38,39 @@ Tree::~Tree() {} | |||
|
|||
ModelImpl::ModelImpl() : _nTree(0) {} | |||
|
|||
ModelImpl::ModelImpl(const ModelImpl & other) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps some small tests could be added for the ones with non-default constructors.
Rule of three violations were fixed mostly by adding default implementations or deleting copy constructors and assignment operators.
The default implementations were added into
Parameter
,Input
,InputIface
,Model
,ModelImpl
classes as they are meant to be copy-assignable and copy-constructible.Non-default implementations of copy constructor and assignment operator were added in GBT
ModelImpl
and multiclass classifierModel
classes because they contain non-POD members.In the internal classes that do not need to be copyable the copy constructors and assignment operators were deleted.
PR completeness and readability
Testing