Skip to content

Commit

Permalink
Fix compExpr
Browse files Browse the repository at this point in the history
  • Loading branch information
vitaut committed Nov 24, 2015
1 parent 507d0ab commit 23c3e20
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions Couenne/src/expression/CouenneExprAux.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#ifndef COUENNE_EXPRAUX_HPP
#define COUENNE_EXPRAUX_HPP

#include <functional>
#include <iostream>

#include "CouenneExprVar.hpp"
Expand Down Expand Up @@ -210,8 +211,11 @@ class exprAux: public exprVar {
struct compExpr {
inline bool operator () (exprAux* e0, exprAux* e1) const
{
return ((e0 -> sign () < e1 -> sign ()) ||
((e0 -> Image () != NULL) && (e1 -> Image () != NULL) && (e0 -> Image () -> compare (*(e1 -> Image ())) < 0)));
if (int result = e0 -> sign () - e1 -> sign ())
return result < 0;
if (e0 -> Image () != NULL && e1 -> Image () != NULL)
return e0 -> Image () -> compare (*e1 -> Image ()) < 0;
return std::less<expression*>()(e0 -> Image (), e1 -> Image ());
}
};

Expand Down

0 comments on commit 23c3e20

Please sign in to comment.