From cc31e48b11e0c2a17ef2156bd795089551c73a84 Mon Sep 17 00:00:00 2001 From: BlackMATov Date: Thu, 12 Jan 2023 10:59:29 +0700 Subject: [PATCH] cleanup indices compare operators --- develop/singles/headers/meta.hpp/meta_all.hpp | 69 +++++++++++++++---- headers/meta.hpp/meta_indices.hpp | 9 +++ .../meta.hpp/meta_indices/argument_index.hpp | 4 ++ .../meta_indices/constructor_index.hpp | 4 ++ .../meta_indices/destructor_index.hpp | 4 ++ .../meta.hpp/meta_indices/evalue_index.hpp | 8 ++- .../meta.hpp/meta_indices/function_index.hpp | 8 ++- .../meta.hpp/meta_indices/member_index.hpp | 8 ++- .../meta.hpp/meta_indices/method_index.hpp | 8 ++- headers/meta.hpp/meta_indices/scope_index.hpp | 8 ++- .../meta.hpp/meta_indices/variable_index.hpp | 8 ++- 11 files changed, 114 insertions(+), 24 deletions(-) diff --git a/develop/singles/headers/meta.hpp/meta_all.hpp b/develop/singles/headers/meta.hpp/meta_all.hpp index 0d9dc23..d584d3a 100644 --- a/develop/singles/headers/meta.hpp/meta_all.hpp +++ b/develop/singles/headers/meta.hpp/meta_all.hpp @@ -2128,6 +2128,7 @@ namespace meta_hpp explicit argument_index(any_type type, std::size_t position); friend bool operator<(const argument_index& l, const argument_index& r) noexcept; friend bool operator==(const argument_index& l, const argument_index& r) noexcept; + friend bool operator!=(const argument_index& l, const argument_index& r) noexcept; private: any_type type_; std::size_t position_{}; @@ -2146,6 +2147,7 @@ namespace meta_hpp explicit constructor_index(constructor_type type); friend bool operator<(const constructor_index& l, const constructor_index& r) noexcept; friend bool operator==(const constructor_index& l, const constructor_index& r) noexcept; + friend bool operator!=(const constructor_index& l, const constructor_index& r) noexcept; private: constructor_type type_; }; @@ -2163,6 +2165,7 @@ namespace meta_hpp explicit destructor_index(destructor_type type); friend bool operator<(const destructor_index& l, const destructor_index& r) noexcept; friend bool operator==(const destructor_index& l, const destructor_index& r) noexcept; + friend bool operator!=(const destructor_index& l, const destructor_index& r) noexcept; private: destructor_type type_; }; @@ -2181,6 +2184,7 @@ namespace meta_hpp explicit evalue_index(enum_type type, std::string name); friend bool operator<(const evalue_index& l, const evalue_index& r) noexcept; friend bool operator==(const evalue_index& l, const evalue_index& r) noexcept; + friend bool operator!=(const evalue_index& l, const evalue_index& r) noexcept; private: enum_type type_; std::string name_; @@ -2200,6 +2204,7 @@ namespace meta_hpp explicit function_index(function_type type, std::string name); friend bool operator<(const function_index& l, const function_index& r) noexcept; friend bool operator==(const function_index& l, const function_index& r) noexcept; + friend bool operator!=(const function_index& l, const function_index& r) noexcept; private: function_type type_; std::string name_; @@ -2219,6 +2224,7 @@ namespace meta_hpp explicit member_index(member_type type, std::string name); friend bool operator<(const member_index& l, const member_index& r) noexcept; friend bool operator==(const member_index& l, const member_index& r) noexcept; + friend bool operator!=(const member_index& l, const member_index& r) noexcept; private: member_type type_; std::string name_; @@ -2238,6 +2244,7 @@ namespace meta_hpp explicit method_index(method_type type, std::string name); friend bool operator<(const method_index& l, const method_index& r) noexcept; friend bool operator==(const method_index& l, const method_index& r) noexcept; + friend bool operator!=(const method_index& l, const method_index& r) noexcept; private: method_type type_; std::string name_; @@ -2255,6 +2262,7 @@ namespace meta_hpp explicit scope_index(std::string name); friend bool operator<(const scope_index& l, const scope_index& r) noexcept; friend bool operator==(const scope_index& l, const scope_index& r) noexcept; + friend bool operator!=(const scope_index& l, const scope_index& r) noexcept; private: std::string name_; }; @@ -2273,6 +2281,7 @@ namespace meta_hpp explicit variable_index(pointer_type type, std::string name); friend bool operator<(const variable_index& l, const variable_index& r) noexcept; friend bool operator==(const variable_index& l, const variable_index& r) noexcept; + friend bool operator!=(const variable_index& l, const variable_index& r) noexcept; private: pointer_type type_; std::string name_; @@ -4421,6 +4430,10 @@ namespace meta_hpp inline bool operator==(const argument_index& l, const argument_index& r) noexcept { return l.type_ == r.type_ && l.position_ == r.position_; } + + inline bool operator!=(const argument_index& l, const argument_index& r) noexcept { + return !(l == r); + } } namespace meta_hpp @@ -4448,6 +4461,10 @@ namespace meta_hpp inline bool operator==(const constructor_index& l, const constructor_index& r) noexcept { return l.type_ == r.type_; } + + inline bool operator!=(const constructor_index& l, const constructor_index& r) noexcept { + return !(l == r); + } } namespace meta_hpp @@ -4475,6 +4492,10 @@ namespace meta_hpp inline bool operator==(const destructor_index& l, const destructor_index& r) noexcept { return l.type_ == r.type_; } + + inline bool operator!=(const destructor_index& l, const destructor_index& r) noexcept { + return !(l == r); + } } namespace meta_hpp @@ -4501,11 +4522,15 @@ namespace meta_hpp } inline bool operator<(const evalue_index& l, const evalue_index& r) noexcept { - return l.type_ < r.type_ || (l.type_ == r.type_ && std::less<>{}(l.name_, r.name_)); + return l.type_ < r.type_ || (l.type_ == r.type_ && l.name_ < r.name_); } inline bool operator==(const evalue_index& l, const evalue_index& r) noexcept { - return l.type_ == r.type_ && std::equal_to<>{}(l.name_, r.name_); + return l.type_ == r.type_ && l.name_ == r.name_; + } + + inline bool operator!=(const evalue_index& l, const evalue_index& r) noexcept { + return !(l == r); } } @@ -4533,11 +4558,15 @@ namespace meta_hpp } inline bool operator<(const function_index& l, const function_index& r) noexcept { - return l.type_ < r.type_ || (l.type_ == r.type_ && std::less<>{}(l.name_, r.name_)); + return l.type_ < r.type_ || (l.type_ == r.type_ && l.name_ < r.name_); } inline bool operator==(const function_index& l, const function_index& r) noexcept { - return l.type_ == r.type_ && std::equal_to<>{}(l.name_, r.name_); + return l.type_ == r.type_ && l.name_ == r.name_; + } + + inline bool operator!=(const function_index& l, const function_index& r) noexcept { + return !(l == r); } } @@ -4565,11 +4594,15 @@ namespace meta_hpp } inline bool operator<(const member_index& l, const member_index& r) noexcept { - return l.type_ < r.type_ || (l.type_ == r.type_ && std::less<>{}(l.name_, r.name_)); + return l.type_ < r.type_ || (l.type_ == r.type_ && l.name_ < r.name_); } inline bool operator==(const member_index& l, const member_index& r) noexcept { - return l.type_ == r.type_ && std::equal_to<>{}(l.name_, r.name_); + return l.type_ == r.type_ && l.name_ == r.name_; + } + + inline bool operator!=(const member_index& l, const member_index& r) noexcept { + return !(l == r); } } @@ -4597,11 +4630,15 @@ namespace meta_hpp } inline bool operator<(const method_index& l, const method_index& r) noexcept { - return l.type_ < r.type_ || (l.type_ == r.type_ && std::less<>{}(l.name_, r.name_)); + return l.type_ < r.type_ || (l.type_ == r.type_ && l.name_ < r.name_); } inline bool operator==(const method_index& l, const method_index& r) noexcept { - return l.type_ == r.type_ && std::equal_to<>{}(l.name_, r.name_); + return l.type_ == r.type_ && l.name_ == r.name_; + } + + inline bool operator!=(const method_index& l, const method_index& r) noexcept { + return !(l == r); } } @@ -4623,11 +4660,15 @@ namespace meta_hpp } inline bool operator<(const scope_index& l, const scope_index& r) noexcept { - return std::less<>{}(l.name_, r.name_); + return l.name_ < r.name_; } inline bool operator==(const scope_index& l, const scope_index& r) noexcept { - return std::equal_to<>{}(l.name_, r.name_); + return l.name_ == r.name_; + } + + inline bool operator!=(const scope_index& l, const scope_index& r) noexcept { + return !(l == r); } } @@ -4655,11 +4696,15 @@ namespace meta_hpp } inline bool operator<(const variable_index& l, const variable_index& r) noexcept { - return l.type_ < r.type_ || (l.type_ == r.type_ && std::less<>{}(l.name_, r.name_)); + return l.type_ < r.type_ || (l.type_ == r.type_ && l.name_ < r.name_); } inline bool operator==(const variable_index& l, const variable_index& r) noexcept { - return l.type_ == r.type_ && std::equal_to<>{}(l.name_, r.name_); + return l.type_ == r.type_ && l.name_ == r.name_; + } + + inline bool operator!=(const variable_index& l, const variable_index& r) noexcept { + return !(l == r); } } diff --git a/headers/meta.hpp/meta_indices.hpp b/headers/meta.hpp/meta_indices.hpp index 5e6a70c..36b6c43 100644 --- a/headers/meta.hpp/meta_indices.hpp +++ b/headers/meta.hpp/meta_indices.hpp @@ -27,6 +27,7 @@ namespace meta_hpp explicit argument_index(any_type type, std::size_t position); friend bool operator<(const argument_index& l, const argument_index& r) noexcept; friend bool operator==(const argument_index& l, const argument_index& r) noexcept; + friend bool operator!=(const argument_index& l, const argument_index& r) noexcept; private: any_type type_; std::size_t position_{}; @@ -45,6 +46,7 @@ namespace meta_hpp explicit constructor_index(constructor_type type); friend bool operator<(const constructor_index& l, const constructor_index& r) noexcept; friend bool operator==(const constructor_index& l, const constructor_index& r) noexcept; + friend bool operator!=(const constructor_index& l, const constructor_index& r) noexcept; private: constructor_type type_; }; @@ -62,6 +64,7 @@ namespace meta_hpp explicit destructor_index(destructor_type type); friend bool operator<(const destructor_index& l, const destructor_index& r) noexcept; friend bool operator==(const destructor_index& l, const destructor_index& r) noexcept; + friend bool operator!=(const destructor_index& l, const destructor_index& r) noexcept; private: destructor_type type_; }; @@ -80,6 +83,7 @@ namespace meta_hpp explicit evalue_index(enum_type type, std::string name); friend bool operator<(const evalue_index& l, const evalue_index& r) noexcept; friend bool operator==(const evalue_index& l, const evalue_index& r) noexcept; + friend bool operator!=(const evalue_index& l, const evalue_index& r) noexcept; private: enum_type type_; std::string name_; @@ -99,6 +103,7 @@ namespace meta_hpp explicit function_index(function_type type, std::string name); friend bool operator<(const function_index& l, const function_index& r) noexcept; friend bool operator==(const function_index& l, const function_index& r) noexcept; + friend bool operator!=(const function_index& l, const function_index& r) noexcept; private: function_type type_; std::string name_; @@ -118,6 +123,7 @@ namespace meta_hpp explicit member_index(member_type type, std::string name); friend bool operator<(const member_index& l, const member_index& r) noexcept; friend bool operator==(const member_index& l, const member_index& r) noexcept; + friend bool operator!=(const member_index& l, const member_index& r) noexcept; private: member_type type_; std::string name_; @@ -137,6 +143,7 @@ namespace meta_hpp explicit method_index(method_type type, std::string name); friend bool operator<(const method_index& l, const method_index& r) noexcept; friend bool operator==(const method_index& l, const method_index& r) noexcept; + friend bool operator!=(const method_index& l, const method_index& r) noexcept; private: method_type type_; std::string name_; @@ -154,6 +161,7 @@ namespace meta_hpp explicit scope_index(std::string name); friend bool operator<(const scope_index& l, const scope_index& r) noexcept; friend bool operator==(const scope_index& l, const scope_index& r) noexcept; + friend bool operator!=(const scope_index& l, const scope_index& r) noexcept; private: std::string name_; }; @@ -172,6 +180,7 @@ namespace meta_hpp explicit variable_index(pointer_type type, std::string name); friend bool operator<(const variable_index& l, const variable_index& r) noexcept; friend bool operator==(const variable_index& l, const variable_index& r) noexcept; + friend bool operator!=(const variable_index& l, const variable_index& r) noexcept; private: pointer_type type_; std::string name_; diff --git a/headers/meta.hpp/meta_indices/argument_index.hpp b/headers/meta.hpp/meta_indices/argument_index.hpp index 761cd4d..772366a 100644 --- a/headers/meta.hpp/meta_indices/argument_index.hpp +++ b/headers/meta.hpp/meta_indices/argument_index.hpp @@ -41,4 +41,8 @@ namespace meta_hpp inline bool operator==(const argument_index& l, const argument_index& r) noexcept { return l.type_ == r.type_ && l.position_ == r.position_; } + + inline bool operator!=(const argument_index& l, const argument_index& r) noexcept { + return !(l == r); + } } diff --git a/headers/meta.hpp/meta_indices/constructor_index.hpp b/headers/meta.hpp/meta_indices/constructor_index.hpp index c9aec8d..d2cea75 100644 --- a/headers/meta.hpp/meta_indices/constructor_index.hpp +++ b/headers/meta.hpp/meta_indices/constructor_index.hpp @@ -36,4 +36,8 @@ namespace meta_hpp inline bool operator==(const constructor_index& l, const constructor_index& r) noexcept { return l.type_ == r.type_; } + + inline bool operator!=(const constructor_index& l, const constructor_index& r) noexcept { + return !(l == r); + } } diff --git a/headers/meta.hpp/meta_indices/destructor_index.hpp b/headers/meta.hpp/meta_indices/destructor_index.hpp index 214530f..faeb3dc 100644 --- a/headers/meta.hpp/meta_indices/destructor_index.hpp +++ b/headers/meta.hpp/meta_indices/destructor_index.hpp @@ -36,4 +36,8 @@ namespace meta_hpp inline bool operator==(const destructor_index& l, const destructor_index& r) noexcept { return l.type_ == r.type_; } + + inline bool operator!=(const destructor_index& l, const destructor_index& r) noexcept { + return !(l == r); + } } diff --git a/headers/meta.hpp/meta_indices/evalue_index.hpp b/headers/meta.hpp/meta_indices/evalue_index.hpp index a605f36..5412f1b 100644 --- a/headers/meta.hpp/meta_indices/evalue_index.hpp +++ b/headers/meta.hpp/meta_indices/evalue_index.hpp @@ -35,10 +35,14 @@ namespace meta_hpp } inline bool operator<(const evalue_index& l, const evalue_index& r) noexcept { - return l.type_ < r.type_ || (l.type_ == r.type_ && std::less<>{}(l.name_, r.name_)); + return l.type_ < r.type_ || (l.type_ == r.type_ && l.name_ < r.name_); } inline bool operator==(const evalue_index& l, const evalue_index& r) noexcept { - return l.type_ == r.type_ && std::equal_to<>{}(l.name_, r.name_); + return l.type_ == r.type_ && l.name_ == r.name_; + } + + inline bool operator!=(const evalue_index& l, const evalue_index& r) noexcept { + return !(l == r); } } diff --git a/headers/meta.hpp/meta_indices/function_index.hpp b/headers/meta.hpp/meta_indices/function_index.hpp index 3abf18c..dc63ac7 100644 --- a/headers/meta.hpp/meta_indices/function_index.hpp +++ b/headers/meta.hpp/meta_indices/function_index.hpp @@ -35,10 +35,14 @@ namespace meta_hpp } inline bool operator<(const function_index& l, const function_index& r) noexcept { - return l.type_ < r.type_ || (l.type_ == r.type_ && std::less<>{}(l.name_, r.name_)); + return l.type_ < r.type_ || (l.type_ == r.type_ && l.name_ < r.name_); } inline bool operator==(const function_index& l, const function_index& r) noexcept { - return l.type_ == r.type_ && std::equal_to<>{}(l.name_, r.name_); + return l.type_ == r.type_ && l.name_ == r.name_; + } + + inline bool operator!=(const function_index& l, const function_index& r) noexcept { + return !(l == r); } } diff --git a/headers/meta.hpp/meta_indices/member_index.hpp b/headers/meta.hpp/meta_indices/member_index.hpp index d983581..be3837e 100644 --- a/headers/meta.hpp/meta_indices/member_index.hpp +++ b/headers/meta.hpp/meta_indices/member_index.hpp @@ -35,10 +35,14 @@ namespace meta_hpp } inline bool operator<(const member_index& l, const member_index& r) noexcept { - return l.type_ < r.type_ || (l.type_ == r.type_ && std::less<>{}(l.name_, r.name_)); + return l.type_ < r.type_ || (l.type_ == r.type_ && l.name_ < r.name_); } inline bool operator==(const member_index& l, const member_index& r) noexcept { - return l.type_ == r.type_ && std::equal_to<>{}(l.name_, r.name_); + return l.type_ == r.type_ && l.name_ == r.name_; + } + + inline bool operator!=(const member_index& l, const member_index& r) noexcept { + return !(l == r); } } diff --git a/headers/meta.hpp/meta_indices/method_index.hpp b/headers/meta.hpp/meta_indices/method_index.hpp index 815276a..8b5ce30 100644 --- a/headers/meta.hpp/meta_indices/method_index.hpp +++ b/headers/meta.hpp/meta_indices/method_index.hpp @@ -35,10 +35,14 @@ namespace meta_hpp } inline bool operator<(const method_index& l, const method_index& r) noexcept { - return l.type_ < r.type_ || (l.type_ == r.type_ && std::less<>{}(l.name_, r.name_)); + return l.type_ < r.type_ || (l.type_ == r.type_ && l.name_ < r.name_); } inline bool operator==(const method_index& l, const method_index& r) noexcept { - return l.type_ == r.type_ && std::equal_to<>{}(l.name_, r.name_); + return l.type_ == r.type_ && l.name_ == r.name_; + } + + inline bool operator!=(const method_index& l, const method_index& r) noexcept { + return !(l == r); } } diff --git a/headers/meta.hpp/meta_indices/scope_index.hpp b/headers/meta.hpp/meta_indices/scope_index.hpp index 26270c7..3652d44 100644 --- a/headers/meta.hpp/meta_indices/scope_index.hpp +++ b/headers/meta.hpp/meta_indices/scope_index.hpp @@ -29,10 +29,14 @@ namespace meta_hpp } inline bool operator<(const scope_index& l, const scope_index& r) noexcept { - return std::less<>{}(l.name_, r.name_); + return l.name_ < r.name_; } inline bool operator==(const scope_index& l, const scope_index& r) noexcept { - return std::equal_to<>{}(l.name_, r.name_); + return l.name_ == r.name_; + } + + inline bool operator!=(const scope_index& l, const scope_index& r) noexcept { + return !(l == r); } } diff --git a/headers/meta.hpp/meta_indices/variable_index.hpp b/headers/meta.hpp/meta_indices/variable_index.hpp index e860071..f18bbf4 100644 --- a/headers/meta.hpp/meta_indices/variable_index.hpp +++ b/headers/meta.hpp/meta_indices/variable_index.hpp @@ -35,10 +35,14 @@ namespace meta_hpp } inline bool operator<(const variable_index& l, const variable_index& r) noexcept { - return l.type_ < r.type_ || (l.type_ == r.type_ && std::less<>{}(l.name_, r.name_)); + return l.type_ < r.type_ || (l.type_ == r.type_ && l.name_ < r.name_); } inline bool operator==(const variable_index& l, const variable_index& r) noexcept { - return l.type_ == r.type_ && std::equal_to<>{}(l.name_, r.name_); + return l.type_ == r.type_ && l.name_ == r.name_; + } + + inline bool operator!=(const variable_index& l, const variable_index& r) noexcept { + return !(l == r); } }