Next: , Previous: change Constructors, Up: The change Class



3.6.3 Operators

— Operator: change& change::operator= (const change& c);

This assigns the value of one change to another.

— Operator: bool change::operator== (const change& c) const;
— Operator: bool change::operator!= (const change& c) const;

These compare two changes. Note that to be equal, the changes must be defined on the same number of bells; for example, "12" on 4 bells is different from "12" on 6 bells.

— Operator: bell& operator*= (bell& b, const change& c);
— Operator: bell operator* (bell b, const change& c);

These return the effect of applying the change c to the bell b. For example, 3 * change(4,"34") == 4. This is useful in tracing the path of one particular bell through a series of changes.

— Operator: ostream& operator<< (ostream& o, const change& c);

This writes the place notation for the change c to the given output stream.

— Operator: bool change::operator< (const change& c) const;
— Operator: bool change::operator> (const change& c) const;
— Operator: bool change::operator<= (const change& c) const;
— Operator: bool change::operator>= (const change& c) const;

If both changes have the same number of bells, these performs a lexicographical comparison on the swaps present in each changes; for example change(6, "14") compares less than change(6, "1236").

If the two changes have different numbers of bells the one with fewer bells compares less than the one with more bells.