>> class Lit {
>>    int     x;
>> public:
>>    Lit() : x(2*var_Undef) {}   // (lit_Undef)
>>    explicit Lit(Var var, bool sign = false) : x((var+var) + (int)sign)
>> { }
>>    friend Lit operator ~ (Lit p) { Lit q; q.x = p.x ^ 1; return q; }
>>
>>    friend bool sign  (Lit p) { return p.x & 1; }
>>    friend int  var   (Lit p) { return p.x >> 1; }
>>    friend int  index (Lit p) { return p.x; }
[...]
>> };

Armel Asselin wrote:
> to be honest your usage of friend seems a bit non-sense to me: friend is
> to make NON MENBER methods (static or not) able to access protected and
> private elements of a class. There you declare bunches of member
> functions as friend: simply remove all these unnecessary 'friend' first.

No he doesn't, they are plain, free functions, not memberfunctions.
However, it is nonetheless pretty backward compared with idiomatic C++
where indeed the typical way would be 

class Lit {
  bool sign() const { return x&1; }
  bool var() const { return x>>1; }
  [...]
};

This doesn't affect the OP's problem though.

Uli

-- 
http://gcc.gnu.org/faq.html
http://parashift.com/c++-faq-lite/

_______________________________________________
help-gplusplus mailing list
help-gplusplus@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gplusplus

Reply via email to