+ // char * == String
+
+ friend bool operator==(const char *y, const String& x)
+ {
+ return strcmp(y, x.p->s) == 0;
+ }
+
+ friend bool operator!=(const char *y, const String& x)
+ {
+ return strcmp(y, x.p->s) != 0;
+ }
+
+ friend bool operator<=(const char *y, const String& x)
+ {
+ return strcmp(y, x.p->s) <= 0;
+ }
+
+ friend bool operator>=(const char *y, const String& x)
+ {
+ return strcmp(y, x.p->s) >= 0;
+ }
+
+ friend bool operator<(const char *y, const String& x)
+ {
+ return strcmp(y, x.p->s) < 0;
+ }
+
+ friend bool operator>(const char *y, const String& x)
+ {
+ return strcmp(y, x.p->s) > 0;
+ }
+
+ // String == std::string
+
+ friend bool operator==(const String& x, const std::string &y)
+ {
+ return strcmp(x.p->s, y.c_str()) == 0;
+ }
+
+ friend bool operator!=(const String& x, const std::string &y)
+ {
+ return strcmp(x.p->s, y.c_str()) == 0;
+ }
+
+ friend bool operator<=(const String& x, const std::string &y)
+ {
+ return strcmp(x.p->s, y.c_str()) <= 0;
+ }
+
+ friend bool operator>=(const String& x, const std::string &y)
+ {
+ return strcmp(x.p->s, y.c_str()) >= 0;
+ }
+
+ friend bool operator<(const String& x, const std::string &y)
+ {
+ return strcmp(x.p->s, y.c_str()) < 0;
+ }
+
+ friend bool operator>(const String& x, const std::string &y)
+ {
+ return strcmp(x.p->s, y.c_str()) > 0;
+ }
+
+ // std::string == String
+
+ friend bool operator==(const std::string &y, const String& x)
+ {
+ return strcmp(y.c_str(), x.p->s) == 0;
+ }
+
+ friend bool operator!=(const std::string &y, const String& x)
+ {
+ return strcmp(y.c_str(), x.p->s) != 0;
+ }
+
+ friend bool operator>=(const std::string &y, const String& x)
+ {
+ return strcmp(y.c_str(), x.p->s) >= 0;
+ }
+
+ friend bool operator<=(const std::string &y, const String& x)
+ {
+ return strcmp(y.c_str(), x.p->s) <= 0;
+ }
+
+ friend bool operator<(const std::string &y, const String& x)
+ {
+ return strcmp(y.c_str(), x.p->s) < 0;
+ }
+
+ friend bool operator>(const std::string &y, const String& x)
+ {
+ return strcmp(y.c_str(), x.p->s) > 0;
+ }
+