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



3.5.3 Operators

— Operator: row& row::operator= (const row& r);

This copies one row to another.

— Operator: row& row::operator= (const char* s);
— Operator: row& row::operator= (const string& s);

This sets the value of a row, given a string. The string s should contain a textual representation of a row, such as 21436587. If the string is not valid, a row::invalid exception is thrown.

— Operator: bool row::operator== (const row& r) const;
— Operator: bool row::operator!= (const row& r) const;

These compare two rows.

— Operator: bell row::operator[] (int i) const;

This returns the ith bell in the row. Note that this is not an lvalue, so you cannot assign a value to an individual bell in a row.

— Operator: row row::operator* (const row& r) const;
— Operator: row& row::operator*= (const row& r);

These functions multiply two rows together as explained above. If the rows are not of the same length, the shorter row is considered to be first padded out to the length of the longer row by adding the extra bells in order at the end.

— Operator: row row::operator/ (const row& r) const;
— Operator: row& row::operator/= (const row& r);

These functions divide two rows, as explained above. If the rows are not of the same length, the shorter row is padded as for multiplication.

— Operator: row& operator*= (row& r, const change& c);
— Operator: row row::operator* (const change& c) const;

These functions apply a change to a row. If the number of bells c differs from the number of bells in r, then c is considered to be padded or truncated in the obvious way.

— Operator: ostream& operator<< (ostream& o, const row& r);

This writes the row to the given output stream, in the same format as returned by row::print().

— Operator: bool row::operator< (const row& other);
— Operator: bool row::operator> (const row& other);
— Operator: bool row::operator<= (const row& other);
— Operator: bool row::operator>= (const row& other);

These functions perform a lexicographical comparison of the two rows. They are necessary in order that rows may be put into certain containers.