2 // GROUPS passed old-abort
10 Rep(const Rep& other): count(0)
13 Rep& operator=(const Rep& other)
14 { /* DO NOT copy over other.count */
17 public: // TODO - for now
18 // Because it is to hard to restrict these operations to the descendants
19 // of Rep<REP> that we haven't named yet. So we just make them public.
23 { if (0 == --count) delete this; }
33 Ref(const Ref<REP>& other): rep(other.rep)
34 { if (rep) rep->inc(); }
36 { if (rep) rep->dec();
39 Ref<REP>& operator=(const Ref<REP>& other)
40 { if (rep != other.rep) {
43 if (rep) rep->inc(); }
47 { return 0 == rep ? TRUE: FALSE; }
49 { return 0 != rep ? TRUE: FALSE; }
51 REP* operator->() const // should be a valid() reference
53 operator REP*() const; // should be a valid() reference
59 { if (rep) rep->inc(); }
61 Ref<REP>& operator=(REP *r)
65 if (rep) rep->inc(); }
70 Ref<REP>::operator REP*() const // should be a valid() reference
75 operator==(const Ref<REP>& a, const Ref<REP>& b)
76 { return (REP *) a == (REP *) b; }
80 operator!=(const Ref<REP>& a, const Ref<REP>& b)
81 { return (REP *) a != (REP *) b; }
83 class XRep: public Rep {