{"id":83,"date":"2012-04-23T13:29:21","date_gmt":"2012-04-23T05:29:21","guid":{"rendered":"http:\/\/fishinbox.tk\/?p=83"},"modified":"2012-04-23T13:29:21","modified_gmt":"2012-04-23T05:29:21","slug":"overload-logical-operators-sort-strings-alphabetically","status":"publish","type":"post","link":"https:\/\/zhuangzr.me\/wordpress\/2012\/04\/overload-logical-operators-sort-strings-alphabetically\/","title":{"rendered":"Overload the Logical Operators to Sort Strings Alphabetically"},"content":{"rendered":"<h1>Overload the Logical Operators to Sort Strings Alphabetically<\/h1>\n<p>In c++, we have function like strcmp(const char* c1,const char* c2) to help us decide which is alphabetically before the other. Yet we still want to use a more easy-going function as a bool operator &lt; or something else like other logical operators.<\/p>\n<p>And here we have a customized user-define class String, which is incomplete due this is only for demonstration of overloading operators.<\/p>\n<pre class=\"brush: cpp; title: ; notranslate\" title=\"\">\n#include &lt;iostream&gt;\n#include &lt;iomanip&gt;\nusing namespace std;\n\nclass String{\n\n\tchar* chars;\n\npublic:\n\n\tint length;\n\n\tString String::operator =(const char* r){\n\t\tlength=strlen(r);\n\t\tchars=(char*)malloc((length+1)*sizeof(char));\n\t\tfor(int i=0;i&lt;=length;i++){\n\t\t\tthis-&gt;chars&#x5B;i]=r&#x5B;i];\n\t\t}\n\t\treturn *this;\n\t}\n\n\tString String::operator =(String r){\n\t\tlength=r.length;\n\t\tchars=(char*)malloc((length+1)*sizeof(char));\n\t\tfor(int i=0;i&lt;=length;i++){\n\t\t\tthis-&gt;chars&#x5B;i]=r&#x5B;i];\n\t\t}\n\t\treturn *this;\n\t}\n\n\tchar &amp;String::operator &#x5B;](int idx){\n\t\treturn chars&#x5B;idx];\n\t}\n\n\tbool operator &lt;(String r)\n\t{\n\t\tfor(int idx=0;idx&lt;=(length&lt;r.length?length:r.length);idx++)\n\t\t{\n\t\t\tif(tolower(chars&#x5B;idx])&lt;tolower(r&#x5B;idx]))\n\t\t\t\treturn true;\n\t\t\telse\n\t\t\t\tif(tolower(chars&#x5B;idx])&gt;tolower(r&#x5B;idx]))\n\t\t\t\t\treturn false;\n\t\t\t\telse\n\t\t\t\t\tcontinue;\n\t\t}\n\t\treturn false;\n\t}\n\n\tbool operator &gt;(String r)\n\t{\n\t\treturn r&lt;*this;\n\t}\n\n\tbool operator ==(String r)\n\t{\n\t\treturn !(*this&gt;r)&amp;&amp;!(*this&lt;r);\n\t}\n\n\tbool operator !=(String r)\n\t{\n\t\treturn !(*this==r);\n\t}\n\n\tbool operator &lt;=(String r)\n\t{\n\t\treturn !(*this&gt;r);\n\t}\n\n\tbool operator &gt;=(String r)\n\t{\n\t\treturn !(*this&lt;r);\n\t}\n\n\tfriend ostream&amp;operator &lt;&lt;(ostream &amp;os,String &amp;right);\n\n\tfriend istream&amp;operator &lt;&lt;(istream &amp;is,String &amp;right);\n\n\tString(int n){\n\t\tlength=n;\n\t\tchars=new char&#x5B;length];\n\t}\n\n\tString (){\n\t\tlength=0;\n\t}\n\n\tString (const char* cs){\n\t\t*this=cs;\n\t}\n\n};\n\nostream &amp; operator&lt;&lt;(ostream &amp;os,  String &amp;right)\n{\n\tfor(int i=0;i&lt;=right.length;i++)\n\t{\n\t\tos&lt;&lt;right&#x5B;i];\n\t}\n\n\treturn os;\n}\n\nistream &amp; operator&gt;&gt;(istream &amp;is,String &amp;right)\n{\n\tint idx=2;\n\tchar* tmpcs=new char&#x5B;idx];\n\tchar c;\n\tint i=0;\n\tfor(;;i++)\n\t{\n\t\tc=is.get();\n\t\tif(c!='n')\n\t\t{\n\t\t\tif(i&gt;=idx)\n\t\t\t{\n\t\t\t\tidx=i+1;\n\t\t\t\ttmpcs=(char*)realloc(tmpcs,idx*sizeof(char));\n\t\t\t}\n\t\t\tif(isalpha(c))\n\t\t\t{\n\t\t\t\ttmpcs&#x5B;i]=c;\n\t\t\t}\n\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif(i&gt;=idx)\n\t\t\t{\n\t\t\t\tidx=i+1;\n\t\t\t\ttmpcs=(char*)realloc(tmpcs,idx*sizeof(char));\n\t\t\t}\n\t\t\ttmpcs&#x5B;i]='';\n\t\t\tbreak;\n\t\t}\n\t}\n\tright=tmpcs;\n\treturn is;\n\n}\n\ntemplate &lt;typename T&gt;\nvoid sort(T *source,int startidx,int endidx)\n{\n\tfor(int i=startidx+1;i&lt;=endidx;i++)\n\t{\n\t\tfor(int j=startidx;j&lt;i;j++)\n\t\t{\n\t\t\tif(source&#x5B;i]&lt;source&#x5B;j])\n\t\t\t{\n\t\t\t\tT key=source&#x5B;i];\n\t\t\t\tfor(int k=i;k&gt;j;k--)\n\t\t\t\t{\n\t\t\t\t\tsource&#x5B;k]=source&#x5B;k-1];\n\t\t\t\t}\n\t\t\t\tsource&#x5B;j]=key;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n}\nint main()\n{\n\tString group&#x5B;5];\n\n\tcout&lt;&lt;&quot;Please input 5 words&quot;&lt;&lt;endl;\n\tfor(int i=0;i&lt;5;i++)\n\t{\n\t\tcin&gt;&gt;group&#x5B;i];\n\t}\n\tsort(group,0,4);\n\tcout&lt;&lt;&quot;after the sorting&quot;&lt;&lt;endl;\n\tfor(int i=0;i&lt;5;i++)\n\t{\n\t\tcout&lt;&lt;group&#x5B;i]&lt;&lt;endl;\n\t}\n\tsystem(&quot;pause&quot;);\n\treturn 0;\n}\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Overload the Logical Operators to Sort Strings Alphabetically In c++, we have function like strcmp(const char* c1,const char* c2) to help us decide which is alphabetically before the other. Yet we still want to use a more easy-going function as a bool operator &lt; or something else like other logical operators. And here we have &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/zhuangzr.me\/wordpress\/2012\/04\/overload-logical-operators-sort-strings-alphabetically\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Overload the Logical Operators to Sort Strings Alphabetically&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[17],"tags":[23,25,28,38,43,63],"class_list":["post-83","post","type-post","status-publish","format-standard","hentry","category-cpp-programming","tag-alphabetically","tag-c","tag-cpp","tag-logical-operators","tag-overload","tag-programming"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 4.9.9 - aioseo.com -->\n\t<meta name=\"description\" content=\"Overload the Logical Operators to Sort Strings Alphabetically\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Hamilleton\"\/>\n\t<meta name=\"google-site-verification\" content=\"MU5z5UygVAc-wvTryHZh_Pyu9TTGhb65shw7AGmXpgE\" \/>\n\t<meta name=\"keywords\" content=\"logical operators,alphabetically,c++,cpp,programming,overload,alphabetically,c++,cpp,logical operators,overload,programming\" \/>\n\t<link rel=\"canonical\" href=\"https:\/\/zhuangzr.me\/wordpress\/2012\/04\/overload-logical-operators-sort-strings-alphabetically\/\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 4.9.9\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"ZigZagRoad | Thoughts in Life and Research on Work\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"Overload the Logical Operators to Sort Strings Alphabetically | ZigZagRoad\" \/>\n\t\t<meta property=\"og:description\" content=\"Overload the Logical Operators to Sort Strings Alphabetically\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/zhuangzr.me\/wordpress\/2012\/04\/overload-logical-operators-sort-strings-alphabetically\/\" \/>\n\t\t<meta property=\"og:image\" content=\"https:\/\/ziruizhuang.github.io\/assets\/img\/prof_pic.jpg\" \/>\n\t\t<meta property=\"og:image:secure_url\" content=\"https:\/\/ziruizhuang.github.io\/assets\/img\/prof_pic.jpg\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2012-04-23T05:29:21+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2012-04-23T05:29:21+00:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary\" \/>\n\t\t<meta name=\"twitter:title\" content=\"Overload the Logical Operators to Sort Strings Alphabetically | ZigZagRoad\" \/>\n\t\t<meta name=\"twitter:description\" content=\"Overload the Logical Operators to Sort Strings Alphabetically\" \/>\n\t\t<meta name=\"twitter:image\" content=\"https:\/\/ziruizhuang.github.io\/assets\/img\/prof_pic.jpg\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/zhuangzr.me\\\/wordpress\\\/2012\\\/04\\\/overload-logical-operators-sort-strings-alphabetically\\\/#article\",\"name\":\"Overload the Logical Operators to Sort Strings Alphabetically | ZigZagRoad\",\"headline\":\"Overload the Logical Operators to Sort Strings Alphabetically\",\"author\":{\"@id\":\"https:\\\/\\\/zhuangzr.me\\\/wordpress\\\/author\\\/hamilleton\\\/#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/zhuangzr.me\\\/wordpress\\\/#person\"},\"datePublished\":\"2012-04-23T13:29:21+08:00\",\"dateModified\":\"2012-04-23T13:29:21+08:00\",\"inLanguage\":\"en-US\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/zhuangzr.me\\\/wordpress\\\/2012\\\/04\\\/overload-logical-operators-sort-strings-alphabetically\\\/#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/zhuangzr.me\\\/wordpress\\\/2012\\\/04\\\/overload-logical-operators-sort-strings-alphabetically\\\/#webpage\"},\"articleSection\":\"C++, Alphabetically, C++, cpp, Logical Operators, overload, Programming\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/zhuangzr.me\\\/wordpress\\\/2012\\\/04\\\/overload-logical-operators-sort-strings-alphabetically\\\/#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/zhuangzr.me\\\/wordpress#listItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/zhuangzr.me\\\/wordpress\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/zhuangzr.me\\\/wordpress\\\/category\\\/study-research-work\\\/#listItem\",\"name\":\"Study, Research and Work\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/zhuangzr.me\\\/wordpress\\\/category\\\/study-research-work\\\/#listItem\",\"position\":2,\"name\":\"Study, Research and Work\",\"item\":\"https:\\\/\\\/zhuangzr.me\\\/wordpress\\\/category\\\/study-research-work\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/zhuangzr.me\\\/wordpress\\\/category\\\/study-research-work\\\/computer-science\\\/#listItem\",\"name\":\"Computer Science\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/zhuangzr.me\\\/wordpress#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/zhuangzr.me\\\/wordpress\\\/category\\\/study-research-work\\\/computer-science\\\/#listItem\",\"position\":3,\"name\":\"Computer Science\",\"item\":\"https:\\\/\\\/zhuangzr.me\\\/wordpress\\\/category\\\/study-research-work\\\/computer-science\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/zhuangzr.me\\\/wordpress\\\/category\\\/study-research-work\\\/computer-science\\\/programming\\\/#listItem\",\"name\":\"Programming\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/zhuangzr.me\\\/wordpress\\\/category\\\/study-research-work\\\/#listItem\",\"name\":\"Study, Research and Work\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/zhuangzr.me\\\/wordpress\\\/category\\\/study-research-work\\\/computer-science\\\/programming\\\/#listItem\",\"position\":4,\"name\":\"Programming\",\"item\":\"https:\\\/\\\/zhuangzr.me\\\/wordpress\\\/category\\\/study-research-work\\\/computer-science\\\/programming\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/zhuangzr.me\\\/wordpress\\\/category\\\/study-research-work\\\/computer-science\\\/programming\\\/cpp-programming\\\/#listItem\",\"name\":\"C++\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/zhuangzr.me\\\/wordpress\\\/category\\\/study-research-work\\\/computer-science\\\/#listItem\",\"name\":\"Computer Science\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/zhuangzr.me\\\/wordpress\\\/category\\\/study-research-work\\\/computer-science\\\/programming\\\/cpp-programming\\\/#listItem\",\"position\":5,\"name\":\"C++\",\"item\":\"https:\\\/\\\/zhuangzr.me\\\/wordpress\\\/category\\\/study-research-work\\\/computer-science\\\/programming\\\/cpp-programming\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/zhuangzr.me\\\/wordpress\\\/2012\\\/04\\\/overload-logical-operators-sort-strings-alphabetically\\\/#listItem\",\"name\":\"Overload the Logical Operators to Sort Strings Alphabetically\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/zhuangzr.me\\\/wordpress\\\/category\\\/study-research-work\\\/computer-science\\\/programming\\\/#listItem\",\"name\":\"Programming\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/zhuangzr.me\\\/wordpress\\\/2012\\\/04\\\/overload-logical-operators-sort-strings-alphabetically\\\/#listItem\",\"position\":6,\"name\":\"Overload the Logical Operators to Sort Strings Alphabetically\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/zhuangzr.me\\\/wordpress\\\/category\\\/study-research-work\\\/computer-science\\\/programming\\\/cpp-programming\\\/#listItem\",\"name\":\"C++\"}}]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/zhuangzr.me\\\/wordpress\\\/#person\",\"name\":\"Hamilleton\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/zhuangzr.me\\\/wordpress\\\/author\\\/hamilleton\\\/#author\",\"url\":\"https:\\\/\\\/zhuangzr.me\\\/wordpress\\\/author\\\/hamilleton\\\/\",\"name\":\"Hamilleton\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/zhuangzr.me\\\/wordpress\\\/2012\\\/04\\\/overload-logical-operators-sort-strings-alphabetically\\\/#webpage\",\"url\":\"https:\\\/\\\/zhuangzr.me\\\/wordpress\\\/2012\\\/04\\\/overload-logical-operators-sort-strings-alphabetically\\\/\",\"name\":\"Overload the Logical Operators to Sort Strings Alphabetically | ZigZagRoad\",\"description\":\"Overload the Logical Operators to Sort Strings Alphabetically\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/zhuangzr.me\\\/wordpress\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/zhuangzr.me\\\/wordpress\\\/2012\\\/04\\\/overload-logical-operators-sort-strings-alphabetically\\\/#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/zhuangzr.me\\\/wordpress\\\/author\\\/hamilleton\\\/#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/zhuangzr.me\\\/wordpress\\\/author\\\/hamilleton\\\/#author\"},\"datePublished\":\"2012-04-23T13:29:21+08:00\",\"dateModified\":\"2012-04-23T13:29:21+08:00\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/zhuangzr.me\\\/wordpress\\\/#website\",\"url\":\"https:\\\/\\\/zhuangzr.me\\\/wordpress\\\/\",\"name\":\"ZigZagRoad\",\"description\":\"Thoughts in Life and Research on Work\",\"inLanguage\":\"en-US\",\"publisher\":{\"@id\":\"https:\\\/\\\/zhuangzr.me\\\/wordpress\\\/#person\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"Overload the Logical Operators to Sort Strings Alphabetically | ZigZagRoad","description":"Overload the Logical Operators to Sort Strings Alphabetically","canonical_url":"https:\/\/zhuangzr.me\/wordpress\/2012\/04\/overload-logical-operators-sort-strings-alphabetically\/","robots":"max-image-preview:large","keywords":"logical operators,alphabetically,c++,cpp,programming,overload,alphabetically,c++,cpp,logical operators,overload,programming","webmasterTools":{"google-site-verification":"MU5z5UygVAc-wvTryHZh_Pyu9TTGhb65shw7AGmXpgE","miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/zhuangzr.me\/wordpress\/2012\/04\/overload-logical-operators-sort-strings-alphabetically\/#article","name":"Overload the Logical Operators to Sort Strings Alphabetically | ZigZagRoad","headline":"Overload the Logical Operators to Sort Strings Alphabetically","author":{"@id":"https:\/\/zhuangzr.me\/wordpress\/author\/hamilleton\/#author"},"publisher":{"@id":"https:\/\/zhuangzr.me\/wordpress\/#person"},"datePublished":"2012-04-23T13:29:21+08:00","dateModified":"2012-04-23T13:29:21+08:00","inLanguage":"en-US","mainEntityOfPage":{"@id":"https:\/\/zhuangzr.me\/wordpress\/2012\/04\/overload-logical-operators-sort-strings-alphabetically\/#webpage"},"isPartOf":{"@id":"https:\/\/zhuangzr.me\/wordpress\/2012\/04\/overload-logical-operators-sort-strings-alphabetically\/#webpage"},"articleSection":"C++, Alphabetically, C++, cpp, Logical Operators, overload, Programming"},{"@type":"BreadcrumbList","@id":"https:\/\/zhuangzr.me\/wordpress\/2012\/04\/overload-logical-operators-sort-strings-alphabetically\/#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/zhuangzr.me\/wordpress#listItem","position":1,"name":"Home","item":"https:\/\/zhuangzr.me\/wordpress","nextItem":{"@type":"ListItem","@id":"https:\/\/zhuangzr.me\/wordpress\/category\/study-research-work\/#listItem","name":"Study, Research and Work"}},{"@type":"ListItem","@id":"https:\/\/zhuangzr.me\/wordpress\/category\/study-research-work\/#listItem","position":2,"name":"Study, Research and Work","item":"https:\/\/zhuangzr.me\/wordpress\/category\/study-research-work\/","nextItem":{"@type":"ListItem","@id":"https:\/\/zhuangzr.me\/wordpress\/category\/study-research-work\/computer-science\/#listItem","name":"Computer Science"},"previousItem":{"@type":"ListItem","@id":"https:\/\/zhuangzr.me\/wordpress#listItem","name":"Home"}},{"@type":"ListItem","@id":"https:\/\/zhuangzr.me\/wordpress\/category\/study-research-work\/computer-science\/#listItem","position":3,"name":"Computer Science","item":"https:\/\/zhuangzr.me\/wordpress\/category\/study-research-work\/computer-science\/","nextItem":{"@type":"ListItem","@id":"https:\/\/zhuangzr.me\/wordpress\/category\/study-research-work\/computer-science\/programming\/#listItem","name":"Programming"},"previousItem":{"@type":"ListItem","@id":"https:\/\/zhuangzr.me\/wordpress\/category\/study-research-work\/#listItem","name":"Study, Research and Work"}},{"@type":"ListItem","@id":"https:\/\/zhuangzr.me\/wordpress\/category\/study-research-work\/computer-science\/programming\/#listItem","position":4,"name":"Programming","item":"https:\/\/zhuangzr.me\/wordpress\/category\/study-research-work\/computer-science\/programming\/","nextItem":{"@type":"ListItem","@id":"https:\/\/zhuangzr.me\/wordpress\/category\/study-research-work\/computer-science\/programming\/cpp-programming\/#listItem","name":"C++"},"previousItem":{"@type":"ListItem","@id":"https:\/\/zhuangzr.me\/wordpress\/category\/study-research-work\/computer-science\/#listItem","name":"Computer Science"}},{"@type":"ListItem","@id":"https:\/\/zhuangzr.me\/wordpress\/category\/study-research-work\/computer-science\/programming\/cpp-programming\/#listItem","position":5,"name":"C++","item":"https:\/\/zhuangzr.me\/wordpress\/category\/study-research-work\/computer-science\/programming\/cpp-programming\/","nextItem":{"@type":"ListItem","@id":"https:\/\/zhuangzr.me\/wordpress\/2012\/04\/overload-logical-operators-sort-strings-alphabetically\/#listItem","name":"Overload the Logical Operators to Sort Strings Alphabetically"},"previousItem":{"@type":"ListItem","@id":"https:\/\/zhuangzr.me\/wordpress\/category\/study-research-work\/computer-science\/programming\/#listItem","name":"Programming"}},{"@type":"ListItem","@id":"https:\/\/zhuangzr.me\/wordpress\/2012\/04\/overload-logical-operators-sort-strings-alphabetically\/#listItem","position":6,"name":"Overload the Logical Operators to Sort Strings Alphabetically","previousItem":{"@type":"ListItem","@id":"https:\/\/zhuangzr.me\/wordpress\/category\/study-research-work\/computer-science\/programming\/cpp-programming\/#listItem","name":"C++"}}]},{"@type":"Person","@id":"https:\/\/zhuangzr.me\/wordpress\/#person","name":"Hamilleton"},{"@type":"Person","@id":"https:\/\/zhuangzr.me\/wordpress\/author\/hamilleton\/#author","url":"https:\/\/zhuangzr.me\/wordpress\/author\/hamilleton\/","name":"Hamilleton"},{"@type":"WebPage","@id":"https:\/\/zhuangzr.me\/wordpress\/2012\/04\/overload-logical-operators-sort-strings-alphabetically\/#webpage","url":"https:\/\/zhuangzr.me\/wordpress\/2012\/04\/overload-logical-operators-sort-strings-alphabetically\/","name":"Overload the Logical Operators to Sort Strings Alphabetically | ZigZagRoad","description":"Overload the Logical Operators to Sort Strings Alphabetically","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/zhuangzr.me\/wordpress\/#website"},"breadcrumb":{"@id":"https:\/\/zhuangzr.me\/wordpress\/2012\/04\/overload-logical-operators-sort-strings-alphabetically\/#breadcrumblist"},"author":{"@id":"https:\/\/zhuangzr.me\/wordpress\/author\/hamilleton\/#author"},"creator":{"@id":"https:\/\/zhuangzr.me\/wordpress\/author\/hamilleton\/#author"},"datePublished":"2012-04-23T13:29:21+08:00","dateModified":"2012-04-23T13:29:21+08:00"},{"@type":"WebSite","@id":"https:\/\/zhuangzr.me\/wordpress\/#website","url":"https:\/\/zhuangzr.me\/wordpress\/","name":"ZigZagRoad","description":"Thoughts in Life and Research on Work","inLanguage":"en-US","publisher":{"@id":"https:\/\/zhuangzr.me\/wordpress\/#person"}}]},"og:locale":"en_US","og:site_name":"ZigZagRoad | Thoughts in Life and Research on Work","og:type":"article","og:title":"Overload the Logical Operators to Sort Strings Alphabetically | ZigZagRoad","og:description":"Overload the Logical Operators to Sort Strings Alphabetically","og:url":"https:\/\/zhuangzr.me\/wordpress\/2012\/04\/overload-logical-operators-sort-strings-alphabetically\/","og:image":"https:\/\/ziruizhuang.github.io\/assets\/img\/prof_pic.jpg","og:image:secure_url":"https:\/\/ziruizhuang.github.io\/assets\/img\/prof_pic.jpg","article:published_time":"2012-04-23T05:29:21+00:00","article:modified_time":"2012-04-23T05:29:21+00:00","twitter:card":"summary","twitter:title":"Overload the Logical Operators to Sort Strings Alphabetically | ZigZagRoad","twitter:description":"Overload the Logical Operators to Sort Strings Alphabetically","twitter:image":"https:\/\/ziruizhuang.github.io\/assets\/img\/prof_pic.jpg"},"aioseo_meta_data":{"post_id":"83","title":"Overload the Logical Operators to Sort Strings Alphabetically | #site_title","description":"Overload the Logical Operators to Sort Strings Alphabetically","keywords":[{"label":"Logical Operators,Alphabetically,c++,cpp,programming,overload","value":"Logical Operators,Alphabetically,c++,cpp,programming,overload"}],"keyphrases":null,"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":null,"og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"","isEnabled":true},"graphs":[],"defaultGraph":"","defaultPostTypeGraph":""},"schema_type":null,"schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"local_seo":null,"breadcrumb_settings":null,"limit_modified_date":false,"ai":null,"created":"2020-12-24 07:00:03","updated":"2025-07-03 08:44:20","seo_analyzer_scan_date":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/zhuangzr.me\/wordpress\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/zhuangzr.me\/wordpress\/category\/study-research-work\/\" title=\"Study, Research and Work\">Study, Research and Work<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/zhuangzr.me\/wordpress\/category\/study-research-work\/computer-science\/\" title=\"Computer Science\">Computer Science<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/zhuangzr.me\/wordpress\/category\/study-research-work\/computer-science\/programming\/\" title=\"Programming\">Programming<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/zhuangzr.me\/wordpress\/category\/study-research-work\/computer-science\/programming\/cpp-programming\/\" title=\"C++\">C++<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tOverload the Logical Operators to Sort Strings Alphabetically\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/zhuangzr.me\/wordpress"},{"label":"Study, Research and Work","link":"https:\/\/zhuangzr.me\/wordpress\/category\/study-research-work\/"},{"label":"Computer Science","link":"https:\/\/zhuangzr.me\/wordpress\/category\/study-research-work\/computer-science\/"},{"label":"Programming","link":"https:\/\/zhuangzr.me\/wordpress\/category\/study-research-work\/computer-science\/programming\/"},{"label":"C++","link":"https:\/\/zhuangzr.me\/wordpress\/category\/study-research-work\/computer-science\/programming\/cpp-programming\/"},{"label":"Overload the Logical Operators to Sort Strings Alphabetically","link":"https:\/\/zhuangzr.me\/wordpress\/2012\/04\/overload-logical-operators-sort-strings-alphabetically\/"}],"_links":{"self":[{"href":"https:\/\/zhuangzr.me\/wordpress\/wp-json\/wp\/v2\/posts\/83","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/zhuangzr.me\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/zhuangzr.me\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/zhuangzr.me\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/zhuangzr.me\/wordpress\/wp-json\/wp\/v2\/comments?post=83"}],"version-history":[{"count":0,"href":"https:\/\/zhuangzr.me\/wordpress\/wp-json\/wp\/v2\/posts\/83\/revisions"}],"wp:attachment":[{"href":"https:\/\/zhuangzr.me\/wordpress\/wp-json\/wp\/v2\/media?parent=83"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/zhuangzr.me\/wordpress\/wp-json\/wp\/v2\/categories?post=83"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/zhuangzr.me\/wordpress\/wp-json\/wp\/v2\/tags?post=83"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}