-
Notifications
You must be signed in to change notification settings - Fork 273
Manage lifetime of MiniSat and Glucose solver pointers using unique_ptr #6078
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
Manage lifetime of MiniSat and Glucose solver pointers using unique_ptr #6078
Conversation
This avoids having definitions of the constructors of `satcheck_minisat_simplifiert` and `satcheck_minisat_no_simplifiert` which were implemented the same way, by having a single template constructor instead. This will simplify subsequent changes to the constructor, because they will only need to be made in one place.
Because this matches the current coding standards, removes a warning from clang-tidy and points out that this is overriding a base class destructor.
This has the benefit of allowing the use of a default destructor rather than a hand written destructor. Note that `satcheck_minisat2_baset` was already non-copyable because its `solver_hardness` field was non-copyable. The default implementation of the destructor is in the `.cpp` rather than the header file in order to avoid recompiling it every time the header file is included.
6fb12df
to
2543943
Compare
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.
LGTM.
Codecov Report
@@ Coverage Diff @@
## develop #6078 +/- ##
===========================================
+ Coverage 74.25% 74.40% +0.15%
===========================================
Files 1445 1446 +1
Lines 157479 157816 +337
===========================================
+ Hits 116933 117427 +494
+ Misses 40546 40389 -157
Continue to review full report at Codecov.
|
Thank you @thomasspriggs, this is so much better than #6070! I had made a brief attempt using |
This avoids having definitions of the constructors of `satcheck_glucose_simplifiert` and `satcheck_glucose_no_simplifiert` which were implemented the same way, by having a single template constructor instead. This will simplify subsequent changes to the constructor, because they will only need to be made in one place.
Because this matches the current coding standards, removes a warning from clang-tidy and points out that this is overriding a base class destructor.
This has the benefit of allowing the use of a default destructor rather than a hand written destructor. Note that `satcheck_glucose_baset` was already non-copyable because its `solver_hardness` field was non-copyable. The default implementation of the destructor is in the `.cpp` rather than the header file in order to avoid recompiling it every time the header file is included and so that the declaration of the solver destructor is available when instantiating the destructor template of `unique_ptr`.
@tautschnig - Done. |
Manage lifetime of MiniSat solver pointer using
unique_ptr
. This has the benefit of allowing the use of a default destructor rather than a hand written destructor. Note thatsatcheck_minisat2_baset
was already non-copyable because itssolver_hardness
field was non-copyable. I have initially raised a PR following this approach for the MiniSat solver only, so I can check whether other maintainers see this as a reasonable approach. If this meets with approval then similar changes could be made for other solvers as well.