Add operator!= and operator< for LanguageTag
authorCarl Hetherington <cth@carlh.net>
Tue, 23 Mar 2021 18:16:46 +0000 (19:16 +0100)
committerCarl Hetherington <cth@carlh.net>
Tue, 23 Mar 2021 18:16:46 +0000 (19:16 +0100)
src/language_tag.cc
src/language_tag.h

index 6c7e6da94e1b6429ffd33945530cfbb63f6ec915..5e2c5a8b0b4593c1130978a0f8547de6d9fa8eb4 100644 (file)
@@ -366,6 +366,20 @@ dcp::operator== (dcp::LanguageTag const& a, dcp::LanguageTag const& b)
 }
 
 
+bool
+dcp::operator!= (dcp::LanguageTag const& a, dcp::LanguageTag const& b)
+{
+       return a.to_string() != b.to_string();
+}
+
+
+bool
+dcp::operator< (dcp::LanguageTag const& a, dcp::LanguageTag const& b)
+{
+       return a.to_string() < b.to_string();
+}
+
+
 ostream&
 dcp::operator<< (ostream& os, dcp::LanguageTag const& tag)
 {
index 1716a8dbdcb3c8e2a465dfcd12d7995e050ed4e3..d18572e4e5661557b0398a746b930bf2fd7ee866 100644 (file)
@@ -240,6 +240,8 @@ private:
 
 
 extern bool operator==(dcp::LanguageTag const& a, dcp::LanguageTag const& b);
+extern bool operator!=(dcp::LanguageTag const& a, dcp::LanguageTag const& b);
+extern bool operator<(dcp::LanguageTag const& a, dcp::LanguageTag const& b);
 extern std::ostream& operator<<(std::ostream& os, dcp::LanguageTag const& tag);