diff --git a/inflection/src/inflection/dialog/DisplayValue.cpp b/inflection/src/inflection/dialog/DisplayValue.cpp index e1054053..902a3999 100644 --- a/inflection/src/inflection/dialog/DisplayValue.cpp +++ b/inflection/src/inflection/dialog/DisplayValue.cpp @@ -57,11 +57,6 @@ bool DisplayValue::operator==(const DisplayValue& o) const return displayString == o.displayString && constraintMap == o.constraintMap; } -bool DisplayValue::operator!=(const DisplayValue& o) const -{ - return !operator==(o); -} - std::size_t DisplayValue::operator()(const DisplayValue& displayValue) const noexcept { return std::hash()(displayValue.displayString); diff --git a/inflection/src/inflection/dialog/DisplayValue.hpp b/inflection/src/inflection/dialog/DisplayValue.hpp index f5014774..861cbf17 100644 --- a/inflection/src/inflection/dialog/DisplayValue.hpp +++ b/inflection/src/inflection/dialog/DisplayValue.hpp @@ -48,16 +48,10 @@ class INFLECTION_CLASS_API inflection::dialog::DisplayValue * @return True if the two display value are the same, false otherwise. */ bool operator==(const DisplayValue& o) const; - /** - * Equivalent to the inverse of operator==. - * @param o The display value object to be compared with this. - * @return True if the two display value are not the same, false otherwise. - */ - bool operator!=(const DisplayValue& o) const; /** * Generates a hash code compatible with std::hash for the displayValue. * @param displayValue The display value object to generate the hash value. - * @return the hash code compatible with std::hash for the displayValue. + * @return the hash code compatible with std::hash for the displayValue. */ std::size_t operator()(const DisplayValue& displayValue) const noexcept; diff --git a/inflection/src/inflection/dialog/NumberConcept.cpp b/inflection/src/inflection/dialog/NumberConcept.cpp index e01c9fb6..75d9b273 100644 --- a/inflection/src/inflection/dialog/NumberConcept.cpp +++ b/inflection/src/inflection/dialog/NumberConcept.cpp @@ -459,9 +459,9 @@ std::size_t NumberConcept::operator()(const NumberConcept& o) const noexcept return o.longValue(); } -bool NumberConcept::operator<(const NumberConcept& o) const +std::partial_ordering NumberConcept::operator<=>(const NumberConcept& o) const { - return doubleValue() < o.doubleValue(); + return doubleValue() <=> o.doubleValue(); } int64_t NumberConcept::longValue() const diff --git a/inflection/src/inflection/dialog/NumberConcept.hpp b/inflection/src/inflection/dialog/NumberConcept.hpp index 0cbe400a..0c016c32 100644 --- a/inflection/src/inflection/dialog/NumberConcept.hpp +++ b/inflection/src/inflection/dialog/NumberConcept.hpp @@ -259,10 +259,11 @@ class INFLECTION_CLASS_API inflection::dialog::NumberConcept std::size_t operator()(const NumberConcept& o) const noexcept; /** - * Returns true when this NumberConcept is less than the other NumberConcept being compared. + * String compares the order of the NumberConcept objects. * Formatting differences are not considered. + * @param o The object to be compared with this. */ - bool operator<(const NumberConcept& o) const; + std::partial_ordering operator<=>(const NumberConcept& o) const; /** * Returns the value of this NumberConcept as a 64-bit number. diff --git a/inflection/src/inflection/dialog/PronounConcept.cpp b/inflection/src/inflection/dialog/PronounConcept.cpp index 8028b596..2ae8cb1c 100644 --- a/inflection/src/inflection/dialog/PronounConcept.cpp +++ b/inflection/src/inflection/dialog/PronounConcept.cpp @@ -481,9 +481,4 @@ bool PronounConcept::operator==(const PronounConcept& other) const constraints == other.constraints; } -bool PronounConcept::operator!=(const PronounConcept& other) const -{ - return !(*this == other); -} - } // namespace inflection::dialog diff --git a/inflection/src/inflection/dialog/PronounConcept.hpp b/inflection/src/inflection/dialog/PronounConcept.hpp index f69b6e6a..e776c907 100644 --- a/inflection/src/inflection/dialog/PronounConcept.hpp +++ b/inflection/src/inflection/dialog/PronounConcept.hpp @@ -108,11 +108,6 @@ class INFLECTION_CLASS_API inflection::dialog::PronounConcept */ bool operator==(const PronounConcept& o) const; - /** - * Equivalent to the inverse of operator== - */ - bool operator!=(const PronounConcept& o) const; - /** * Constructs a new PronounConcept based on custom pronouns. Any unspecified pronouns will use the language's default pronouns. * @param model The SemanticFeatureModel for the language diff --git a/inflection/src/inflection/dialog/SemanticConcept.cpp b/inflection/src/inflection/dialog/SemanticConcept.cpp index 5d71794e..43d2e663 100644 --- a/inflection/src/inflection/dialog/SemanticConcept.cpp +++ b/inflection/src/inflection/dialog/SemanticConcept.cpp @@ -194,9 +194,4 @@ bool SemanticConcept::operator==(const SemanticConcept& other) const return getModel() == other.getModel() && semantic == other.semantic && defaultToSemantic == other.defaultToSemantic && getSpeakFeature() == other.getSpeakFeature() && constraints == other.constraints; } -bool SemanticConcept::operator!=(const SemanticConcept& other) const -{ - return !(*this == other); -} - } // namespace inflection::dialog diff --git a/inflection/src/inflection/dialog/SemanticConcept.hpp b/inflection/src/inflection/dialog/SemanticConcept.hpp index 5bdad559..ce95cadb 100644 --- a/inflection/src/inflection/dialog/SemanticConcept.hpp +++ b/inflection/src/inflection/dialog/SemanticConcept.hpp @@ -81,11 +81,6 @@ class INFLECTION_CLASS_API inflection::dialog::SemanticConcept */ bool operator==(const SemanticConcept& o) const; - /** - * Equivalent to the inverse of operator== - */ - bool operator!=(const SemanticConcept& o) const; - /** * Constructs a new SemanticConcept. A SemanticFeatureModel is required, as it will enforce the locale and store display data. */ diff --git a/inflection/src/inflection/dialog/SemanticFeature.cpp b/inflection/src/inflection/dialog/SemanticFeature.cpp index 16e84e50..105c9141 100644 --- a/inflection/src/inflection/dialog/SemanticFeature.cpp +++ b/inflection/src/inflection/dialog/SemanticFeature.cpp @@ -72,14 +72,14 @@ bool SemanticFeature::isAliased() const return aliased; } -bool SemanticFeature::operator<(const SemanticFeature& other) const +std::weak_ordering SemanticFeature::operator<=>(const SemanticFeature& other) const { - return name < other.name; + return name <=> other.name; } bool SemanticFeature::operator==(const SemanticFeature& other) const { - return name == other.name; + return (*this <=> other) == 0; } } // namespace inflection::dialog diff --git a/inflection/src/inflection/dialog/SemanticFeature.hpp b/inflection/src/inflection/dialog/SemanticFeature.hpp index 1b671c1a..145c3e50 100644 --- a/inflection/src/inflection/dialog/SemanticFeature.hpp +++ b/inflection/src/inflection/dialog/SemanticFeature.hpp @@ -72,7 +72,6 @@ class INFLECTION_CLASS_API inflection::dialog::SemanticFeature * aliased without specifying the name. */ virtual bool isAliased() const; - bool operator<(const SemanticFeature& other) const; /** * Returns true when both objects refer to the same semantic feature, with the same * name. @@ -80,6 +79,10 @@ class INFLECTION_CLASS_API inflection::dialog::SemanticFeature * @return True if the two semantic feature are the same, false otherwise. */ bool operator==(const SemanticFeature& other) const; + /** + * @param other The semantic feature object to be compared with this. + */ + std::weak_ordering operator<=>(const SemanticFeature& other) const; /** * Construct the SemanticFeature from the name, type, bounded values. diff --git a/inflection/src/inflection/dialog/SemanticFeatureModel_DisplayData.cpp b/inflection/src/inflection/dialog/SemanticFeatureModel_DisplayData.cpp index 597078df..f4a6619d 100644 --- a/inflection/src/inflection/dialog/SemanticFeatureModel_DisplayData.cpp +++ b/inflection/src/inflection/dialog/SemanticFeatureModel_DisplayData.cpp @@ -36,9 +36,4 @@ bool SemanticFeatureModel_DisplayData::operator==(const SemanticFeatureModel_Dis return allValues == o.allValues; } -bool SemanticFeatureModel_DisplayData::operator!=(const SemanticFeatureModel_DisplayData& o) const -{ - return !operator==(o); -} - } // namespace inflection::dialog diff --git a/inflection/src/inflection/dialog/SemanticFeatureModel_DisplayData.hpp b/inflection/src/inflection/dialog/SemanticFeatureModel_DisplayData.hpp index a7eefcc2..bcf50f67 100644 --- a/inflection/src/inflection/dialog/SemanticFeatureModel_DisplayData.hpp +++ b/inflection/src/inflection/dialog/SemanticFeatureModel_DisplayData.hpp @@ -43,12 +43,6 @@ class INFLECTION_CLASS_API inflection::dialog::SemanticFeatureModel_DisplayData * @return True if the two display data are the same, false otherwise. */ bool operator==(const SemanticFeatureModel_DisplayData& o) const; - /** - * Equivalent to the inverse of operator==. - * @param o The display data object to be compared with this. - * @return True if the two display data are not the same, false otherwise. - */ - bool operator!=(const SemanticFeatureModel_DisplayData& o) const; /** * Construct the display data with all of the known display values. Typically the first display value is shown that matches the desired semantic features. diff --git a/inflection/src/inflection/dialog/SpeakableString.cpp b/inflection/src/inflection/dialog/SpeakableString.cpp index e7d823de..05c4cbbc 100644 --- a/inflection/src/inflection/dialog/SpeakableString.cpp +++ b/inflection/src/inflection/dialog/SpeakableString.cpp @@ -71,11 +71,6 @@ bool SpeakableString::operator==(const SpeakableString& o) const return this->print == o.print && ((this->speak == nullptr && o.speak == nullptr) || (this->speak != nullptr && o.speak != nullptr && *this->speak == *o.speak)); } -bool SpeakableString::operator!=(const SpeakableString& o) const -{ - return !(*this == o); -} - SpeakableString SpeakableString::operator+(const SpeakableString& o) const { ::std::u16string print(this->print); diff --git a/inflection/src/inflection/dialog/SpeakableString.hpp b/inflection/src/inflection/dialog/SpeakableString.hpp index c09e99a4..3d781597 100644 --- a/inflection/src/inflection/dialog/SpeakableString.hpp +++ b/inflection/src/inflection/dialog/SpeakableString.hpp @@ -54,12 +54,6 @@ class INFLECTION_CLASS_API inflection::dialog::SpeakableString * @return True if the two speakable string are the same, false otherwise. */ bool operator==(const ::inflection::dialog::SpeakableString& o) const; - /** - * Equivalent to the inverse of operator==. - * @param o The speakable string object to be compared with this. - * @return True if the two display value are not the same, false otherwise. - */ - bool operator!=(const ::inflection::dialog::SpeakableString& o) const; /** * Create a new speakable string by appened other to this. * @param o the speakable string to be appened with this. diff --git a/inflection/src/inflection/dictionary/DictionaryKeyIterator.cpp b/inflection/src/inflection/dictionary/DictionaryKeyIterator.cpp index 5f3818b0..c703e588 100644 --- a/inflection/src/inflection/dictionary/DictionaryKeyIterator.cpp +++ b/inflection/src/inflection/dictionary/DictionaryKeyIterator.cpp @@ -42,11 +42,6 @@ DictionaryKeyIterator::operator==(const DictionaryKeyIterator& rhs) const { return *trieIterator == *rhs.trieIterator; } -bool -DictionaryKeyIterator::operator!=(const DictionaryKeyIterator& rhs) const { - return !(*this == rhs); -} - DictionaryKeyIterator DictionaryKeyIterator::begin() const { diff --git a/inflection/src/inflection/dictionary/DictionaryKeyIterator.hpp b/inflection/src/inflection/dictionary/DictionaryKeyIterator.hpp index 06ea8119..065497b5 100644 --- a/inflection/src/inflection/dictionary/DictionaryKeyIterator.hpp +++ b/inflection/src/inflection/dictionary/DictionaryKeyIterator.hpp @@ -45,10 +45,6 @@ class INFLECTION_CLASS_API inflection::dictionary::DictionaryKeyIterator * Return true when this is equal to the other iterator. */ bool operator==(const DictionaryKeyIterator& rhs) const; - /** - * Return false when this is equal to the other iterator. - */ - bool operator!=(const DictionaryKeyIterator& rhs) const; /** * The first word in the dictionary. diff --git a/inflection/src/inflection/dictionary/Inflector_InflectionPattern.cpp b/inflection/src/inflection/dictionary/Inflector_InflectionPattern.cpp index 9194b5f0..cc89ad0e 100644 --- a/inflection/src/inflection/dictionary/Inflector_InflectionPattern.cpp +++ b/inflection/src/inflection/dictionary/Inflector_InflectionPattern.cpp @@ -301,8 +301,8 @@ int32_t Inflector_InflectionPattern::numInflections() const return numOfInflections; } -bool Inflector_InflectionPattern::operator<(const Inflector_InflectionPattern& other) const { - return (getIdentifier() < other.getIdentifier()); +std::weak_ordering Inflector_InflectionPattern::operator<=>(const Inflector_InflectionPattern& other) const { + return getIdentifier() <=> other.getIdentifier(); } int64_t Inflector_InflectionPattern::firstContainingPartOfSpeech(const ::std::vector &partOfSpeechList) const { diff --git a/inflection/src/inflection/dictionary/Inflector_InflectionPattern.hpp b/inflection/src/inflection/dictionary/Inflector_InflectionPattern.hpp index 3cda4fb1..39f345de 100644 --- a/inflection/src/inflection/dictionary/Inflector_InflectionPattern.hpp +++ b/inflection/src/inflection/dictionary/Inflector_InflectionPattern.hpp @@ -45,7 +45,7 @@ class inflection::dictionary::Inflector_InflectionPattern final int64_t firstContainingPartOfSpeech(const ::std::vector &partOfSpeech) const; int64_t getPartsOfSpeech() const; - bool operator<(const Inflector_InflectionPattern& other) const; + std::weak_ordering operator<=>(const Inflector_InflectionPattern& other) const; private: Inflector_InflectionPattern() = delete; diff --git a/inflection/src/inflection/dictionary/metadata/MarisaTrieIterator.hpp b/inflection/src/inflection/dictionary/metadata/MarisaTrieIterator.hpp index 1b72469e..62275e0a 100644 --- a/inflection/src/inflection/dictionary/metadata/MarisaTrieIterator.hpp +++ b/inflection/src/inflection/dictionary/metadata/MarisaTrieIterator.hpp @@ -48,7 +48,6 @@ class inflection::dictionary::metadata::MarisaTrieIterator MarisaTrieIterator& operator++(); bool operator==(const MarisaTrieIterator& rhs) const; - bool operator!=(const MarisaTrieIterator& rhs) const; MarisaTrieIterator begin() const; MarisaTrieIterator end() const; @@ -92,12 +91,6 @@ inflection::dictionary::metadata::MarisaTrieIterator::operator==(const Marisa return &trie == &rhs.trie && reachedEnd == rhs.reachedEnd && (reachedEnd || agent.key().id() == rhs.agent.key().id()); } -template -bool -inflection::dictionary::metadata::MarisaTrieIterator::operator!=(const MarisaTrieIterator& rhs) const { - return !(*this == rhs); -} - template inflection::dictionary::metadata::MarisaTrieIterator inflection::dictionary::metadata::MarisaTrieIterator::begin() const diff --git a/inflection/src/inflection/lang/features/LanguageGrammarFeatures_GrammarCategory.cpp b/inflection/src/inflection/lang/features/LanguageGrammarFeatures_GrammarCategory.cpp index fc008116..1df794c4 100644 --- a/inflection/src/inflection/lang/features/LanguageGrammarFeatures_GrammarCategory.cpp +++ b/inflection/src/inflection/lang/features/LanguageGrammarFeatures_GrammarCategory.cpp @@ -50,14 +50,9 @@ std::multimap LanguageGrammarFeatures_GrammarCat return {}; } -int32_t LanguageGrammarFeatures_GrammarCategory::compareTo(const LanguageGrammarFeatures_GrammarCategory& o) const +std::weak_ordering LanguageGrammarFeatures_GrammarCategory::operator<=>(const LanguageGrammarFeatures_GrammarCategory& other) const { - return name.compare(o.name); -} - -bool LanguageGrammarFeatures_GrammarCategory::operator<(const LanguageGrammarFeatures_GrammarCategory& other) const -{ - return (name.compare(other.name)) < 0; + return name <=> other.name; } } // namespace inflection::lang::features diff --git a/inflection/src/inflection/lang/features/LanguageGrammarFeatures_GrammarCategory.hpp b/inflection/src/inflection/lang/features/LanguageGrammarFeatures_GrammarCategory.hpp index 84d25d8b..49d7ea66 100644 --- a/inflection/src/inflection/lang/features/LanguageGrammarFeatures_GrammarCategory.hpp +++ b/inflection/src/inflection/lang/features/LanguageGrammarFeatures_GrammarCategory.hpp @@ -61,15 +61,10 @@ class INFLECTION_CLASS_API inflection::lang::features::LanguageGrammarFeatures_G std::multimap getGrammemeDependenciesForValue(std::u16string_view grammemeValue) const; /** - * Compares the name of this grammar category with the other.. - * @param other The grammar category object to be compared with this. - * @return the value 0 if the name of the argument other is equal to the name of this; a value -1 if the name - * of this is lexicographically less than the name of the argument other; and a value 1 if the name - * of this is lexicographically greater than the name of the argument other. + * String compares the order of the name. + * @param other The object to be compared with this. */ - virtual int32_t compareTo(const LanguageGrammarFeatures_GrammarCategory& other) const; - bool operator<(const LanguageGrammarFeatures_GrammarCategory& other) const; - + std::weak_ordering operator<=>(const LanguageGrammarFeatures_GrammarCategory& other) const; private: /* package */ LanguageGrammarFeatures_GrammarCategory(const std::u16string& name, const std::set& values, diff --git a/inflection/src/inflection/lang/features/LanguageGrammarFeatures_GrammarFeatures.cpp b/inflection/src/inflection/lang/features/LanguageGrammarFeatures_GrammarFeatures.cpp index dd967b9c..e6330d48 100644 --- a/inflection/src/inflection/lang/features/LanguageGrammarFeatures_GrammarFeatures.cpp +++ b/inflection/src/inflection/lang/features/LanguageGrammarFeatures_GrammarFeatures.cpp @@ -26,14 +26,9 @@ std::vector LanguageGrammarFeatures_GrammarFeat return values; } -int32_t LanguageGrammarFeatures_GrammarFeatures::compareTo(const LanguageGrammarFeatures_GrammarFeatures& o) const +std::weak_ordering LanguageGrammarFeatures_GrammarFeatures::operator<=>(const LanguageGrammarFeatures_GrammarFeatures& other) const { - return name.compare(o.name); -} - -bool LanguageGrammarFeatures_GrammarFeatures::operator<(const LanguageGrammarFeatures_GrammarFeatures& other) const -{ - return (name.compare(other.name)) < 0; + return name <=> other.name; } } // namespace inflection::lang::features diff --git a/inflection/src/inflection/lang/features/LanguageGrammarFeatures_GrammarFeatures.hpp b/inflection/src/inflection/lang/features/LanguageGrammarFeatures_GrammarFeatures.hpp index 41a3c876..d2be9a30 100644 --- a/inflection/src/inflection/lang/features/LanguageGrammarFeatures_GrammarFeatures.hpp +++ b/inflection/src/inflection/lang/features/LanguageGrammarFeatures_GrammarFeatures.hpp @@ -38,14 +38,10 @@ class INFLECTION_CLASS_API inflection::lang::features::LanguageGrammarFeatures_G */ std::vector<::inflection::lang::features::LanguageGrammarFeatures_Feature> getValues() const; /** - * Compares the name of this grammar features with the other.. - * @param other The grammar features object to be compared with this. - * @return the value 0 if the name of the argument other is equal to the name of this; a value -1 if the name - * of this is lexicographically less than the name of the argument other; and a value 1 if the name - * of this is lexicographically greater than the name of the argument other. + * String compares the order of the name. + * @param other The object to be compared with this. */ - virtual int32_t compareTo(const LanguageGrammarFeatures_GrammarFeatures& other) const; - bool operator<(const LanguageGrammarFeatures_GrammarFeatures& other) const; + std::weak_ordering operator<=>(const LanguageGrammarFeatures_GrammarFeatures& other) const; protected: /* package */ /** diff --git a/inflection/src/inflection/tokenizer/Token.cpp b/inflection/src/inflection/tokenizer/Token.cpp index fe292b60..09399524 100644 --- a/inflection/src/inflection/tokenizer/Token.cpp +++ b/inflection/src/inflection/tokenizer/Token.cpp @@ -55,11 +55,6 @@ bool Token::operator==(const Token& rhs) const return getLength() == rhs.getLength() && isSignificant() == rhs.isSignificant() && isHead() == rhs.isHead() && isTail() == rhs.isTail() && isWhitespace() == rhs.isWhitespace() && getCleanValue() == rhs.getCleanValue() && getValue() == rhs.getValue(); } -bool Token::operator!=(const Token& rhs) const -{ - return !(*this == rhs); -} - std::size_t Token::operator()(const Token& token) const noexcept { return std::hash()(token.value); diff --git a/inflection/src/inflection/tokenizer/Token.hpp b/inflection/src/inflection/tokenizer/Token.hpp index be38e3ee..3143644a 100644 --- a/inflection/src/inflection/tokenizer/Token.hpp +++ b/inflection/src/inflection/tokenizer/Token.hpp @@ -88,13 +88,6 @@ class INFLECTION_INTERNAL_API inflection::tokenizer::Token * @return True if the two are the same, false otherwise. */ bool operator==(const ::inflection::tokenizer::Token& rhs) const; - /** - * Checks if the two Tokens are not the same. - * - * @param rhs Other Token being compared to. - * @return True if the two are not the same, false otherwise. - */ - bool operator!=(const ::inflection::tokenizer::Token& rhs) const; /** * Generates a unique hash of this Token. * diff --git a/inflection/src/inflection/tokenizer/TokenChain.cpp b/inflection/src/inflection/tokenizer/TokenChain.cpp index 9016e080..6bf9d2db 100644 --- a/inflection/src/inflection/tokenizer/TokenChain.cpp +++ b/inflection/src/inflection/tokenizer/TokenChain.cpp @@ -82,12 +82,6 @@ bool TokenChain::operator==(const TokenChain& rhs) const return rightPointer == nullptr; } -bool -TokenChain::operator!=(const TokenChain& rhs) const -{ - return !(*this == rhs); -} - std::size_t TokenChain::operator()(const TokenChain& tokenChain) const noexcept { std::size_t hash = 0; diff --git a/inflection/src/inflection/tokenizer/TokenChain.hpp b/inflection/src/inflection/tokenizer/TokenChain.hpp index 2105615c..13893c38 100644 --- a/inflection/src/inflection/tokenizer/TokenChain.hpp +++ b/inflection/src/inflection/tokenizer/TokenChain.hpp @@ -39,13 +39,6 @@ class INFLECTION_INTERNAL_API inflection::tokenizer::TokenChain * @return true if both TokenChains are equal. */ bool operator==(const inflection::tokenizer::TokenChain& rhs) const; - /** - * Returns true if both TokenChains are not equal. - * - * @param rhs The other TokenChain. - * @return true if both TokenChains are not equal. - */ - bool operator!=(const inflection::tokenizer::TokenChain& rhs) const; /** * Returns a unique std::size_t hash of the entire TokenChain. This hash is calculated by summing all the * hashes of each Token in the TokenChain. diff --git a/inflection/src/inflection/tokenizer/TokenIterator.cpp b/inflection/src/inflection/tokenizer/TokenIterator.cpp index b9399d3e..081fda75 100644 --- a/inflection/src/inflection/tokenizer/TokenIterator.cpp +++ b/inflection/src/inflection/tokenizer/TokenIterator.cpp @@ -65,9 +65,4 @@ TokenIterator::operator==(const TokenIterator& rhs) const { return token == rhs.token; } -bool -TokenIterator::operator!=(const TokenIterator& rhs) const { - return !(*this == rhs); -} - } // namespace inflection diff --git a/inflection/src/inflection/tokenizer/TokenIterator.hpp b/inflection/src/inflection/tokenizer/TokenIterator.hpp index 92c8d7d4..3255981c 100644 --- a/inflection/src/inflection/tokenizer/TokenIterator.hpp +++ b/inflection/src/inflection/tokenizer/TokenIterator.hpp @@ -37,7 +37,6 @@ class INFLECTION_INTERNAL_API inflection::tokenizer::TokenIterator TokenIterator operator--(int postDecrement); bool operator==(const TokenIterator& rhs) const; - bool operator!=(const TokenIterator& rhs) const; private: const Token* token; diff --git a/inflection/src/inflection/util/ULocale.hpp b/inflection/src/inflection/util/ULocale.hpp index cd8de17b..93e28a01 100644 --- a/inflection/src/inflection/util/ULocale.hpp +++ b/inflection/src/inflection/util/ULocale.hpp @@ -142,29 +142,11 @@ class INFLECTION_CLASS_API inflection::util::ULocale bool operator==(const ::inflection::util::ULocale& other) const; /** - * Checks if two locale keys are not the same. + * String compares the order of the locale key. * * @param other The locale key object to be compared with this. - * @return True if the two locale keys are not the same, false - * otherwise. */ - bool operator!=(const ::inflection::util::ULocale& other) const; - - /** - * Checks if this locale key is less than the other. - * - * @param other The locale key object to be compared with this. - * @return True if this locale key is less than the other, false otherwise. - */ - bool operator<(const ::inflection::util::ULocale& other) const; - - /** - * Checks if this locale key is greater than the other. - * - * @param other The locale key object to be compared with this. - * @return True if this locale key is greater than the other, false otherwise. - */ - bool operator>(const ::inflection::util::ULocale& other) const; + std::strong_ordering operator<=>(const ::inflection::util::ULocale& other) const; /** * Returns the locale's ISO-639 language code. @@ -231,25 +213,13 @@ class INFLECTION_CLASS_API inflection::util::ULocale inline bool inflection::util::ULocale::operator==(const ::inflection::util::ULocale& other) const { - return other.fullName == fullName; + return other <=> *this == 0; } -inline bool -inflection::util::ULocale::operator!=(const ::inflection::util::ULocale& other) const -{ - return !operator==(other); -} - -inline bool -inflection::util::ULocale::operator<(const ::inflection::util::ULocale& other) const -{ - return fullName < other.fullName; -} - -inline bool -inflection::util::ULocale::operator>(const ::inflection::util::ULocale& other) const +inline std::strong_ordering +inflection::util::ULocale::operator<=>(const ::inflection::util::ULocale& other) const { - return fullName > other.fullName; + return fullName <=> other.fullName; } inline ::std::string_view