summaryrefslogtreecommitdiff
path: root/src/theory/arith/cut_log.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/theory/arith/cut_log.cpp')
-rw-r--r--src/theory/arith/cut_log.cpp52
1 files changed, 24 insertions, 28 deletions
diff --git a/src/theory/arith/cut_log.cpp b/src/theory/arith/cut_log.cpp
index e9df7559d..43ef97123 100644
--- a/src/theory/arith/cut_log.cpp
+++ b/src/theory/arith/cut_log.cpp
@@ -98,21 +98,19 @@ std::ostream& operator<<(std::ostream& os, const PrimitiveVec& pv){
}
CutInfo::CutInfo(CutInfoKlass kl, int eid, int o)
- : d_klass(kl)
- , d_execOrd(eid)
- , d_poolOrd(o)
- , d_cutType(kind::UNDEFINED_KIND)
- , d_cutRhs()
- , d_cutVec()
- , d_mAtCreation(-1)
- , d_rowId(-1)
- , d_exactPrecision(NULL)
- , d_explanation(NULL)
+ : d_klass(kl),
+ d_execOrd(eid),
+ d_poolOrd(o),
+ d_cutType(kind::UNDEFINED_KIND),
+ d_cutRhs(),
+ d_cutVec(),
+ d_mAtCreation(-1),
+ d_rowId(-1),
+ d_exactPrecision(nullptr),
+ d_explanation(nullptr)
{}
CutInfo::~CutInfo(){
- if(d_exactPrecision == NULL){ delete d_exactPrecision; }
- if(d_explanation == NULL){ delete d_explanation; }
}
int CutInfo::getId() const {
@@ -164,9 +162,7 @@ void CutInfo::setRhs(double r){
d_cutRhs = r;
}
-bool CutInfo::reconstructed() const{
- return d_exactPrecision != NULL;
-}
+bool CutInfo::reconstructed() const { return d_exactPrecision != nullptr; }
CutInfoKlass CutInfo::getKlass() const{
return d_klass;
@@ -190,9 +186,7 @@ int CutInfo::getMAtCreation() const{
}
/* Returns true if the cut has an explanation. */
-bool CutInfo::proven() const{
- return d_explanation != NULL;
-}
+bool CutInfo::proven() const { return d_explanation != nullptr; }
bool CutInfo::operator<(const CutInfo& o) const{
return d_execOrd < o.d_execOrd;
@@ -201,14 +195,17 @@ bool CutInfo::operator<(const CutInfo& o) const{
void CutInfo::setReconstruction(const DenseVector& ep){
Assert(!reconstructed());
- d_exactPrecision = new DenseVector(ep);
+ d_exactPrecision.reset(new DenseVector(ep));
}
void CutInfo::setExplanation(const ConstraintCPVec& ex){
Assert(reconstructed());
- if(d_explanation == NULL){
- d_explanation = new ConstraintCPVec(ex);
- }else{
+ if (d_explanation == nullptr)
+ {
+ d_explanation.reset(new ConstraintCPVec(ex));
+ }
+ else
+ {
*d_explanation = ex;
}
}
@@ -216,8 +213,9 @@ void CutInfo::setExplanation(const ConstraintCPVec& ex){
void CutInfo::swapExplanation(ConstraintCPVec& ex){
Assert(reconstructed());
Assert(!proven());
- if(d_explanation == NULL){
- d_explanation = new ConstraintCPVec();
+ if (d_explanation == nullptr)
+ {
+ d_explanation.reset(new ConstraintCPVec());
}
d_explanation->swap(ex);
}
@@ -229,13 +227,11 @@ const DenseVector& CutInfo::getReconstruction() const {
void CutInfo::clearReconstruction(){
if(proven()){
- delete d_explanation;
- d_explanation = NULL;
+ d_explanation = nullptr;
}
if(reconstructed()){
- delete d_exactPrecision;
- d_exactPrecision = NULL;
+ d_exactPrecision = nullptr;
}
Assert(!reconstructed());
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback