Skip to content

Commit

Permalink
fixed illegal friend declaration of mkLiteral (same issue in minisat)
Browse files Browse the repository at this point in the history
According to ISO C++11 standard:
"If a friend declaration specifies a default argument expression, that
declaration shall be a definition and shall be the only declaration of the
function or function template in the translation unit.”

Solved in the same way as the minisat project niklasso/minisat#17:
niklasso/minisat#17
  • Loading branch information
maelvls committed Nov 12, 2017
1 parent 02af653 commit 262111d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/solver_types.hh
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,15 @@ struct Literal {
int x;

// Use this as a constructor:
friend Literal mkLiteral(Variable var, bool sign = false);
//friend Literal mkLiteral(Variable var, bool sign = false);

bool operator == (Literal p) const { return x == p.x; }
bool operator != (Literal p) const { return x != p.x; }
bool operator < (Literal p) const { return x < p.x; } // '<' makes p, ~p adjacent in the ordering.
bool operator <= (Literal p) const { return x <= p.x; }
};

inline Literal mkLiteral (Variable var, bool sign) { Literal p; p.x = var + var + (int)sign; return p; }
inline Literal mkLiteral (Variable var, bool sign = false) { Literal p; p.x = var + var + (int)sign; return p; }
inline Literal operator ~(Literal p) { Literal q; q.x = p.x ^ 1; return q; }
inline Literal operator ^(Literal p, bool b) { Literal q; q.x = p.x ^ (unsigned int)b; return q; }
inline bool sign (Literal p) { return p.x & 1; }
Expand Down

0 comments on commit 262111d

Please sign in to comment.