nbool operator < (const
string & s1, char * lit) {
n return (strcmp(s1.str, lit) < 0);
n}
n
nbool operator < (const
string & s1, const string & s2) {
n return (strcmp(s1.str, s2.str) < 0);
n}
n
nThen, you could implement
the > either of the following:
n
nbool operator >= (char
* lit, const string & s1) {
n return (strcmp(lit, s1.str) >= 0);
n}
n
nor,
n
nbool operator >= (char
* lit, const string & s1) {
n return (s1 < lit);
n}
n
nWhich is better?