cleanup indices compare operators

This commit is contained in:
BlackMATov
2023-01-12 10:59:29 +07:00
parent e2d5ae5e6d
commit cc31e48b11
11 changed files with 114 additions and 24 deletions

View File

@@ -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_;

View File

@@ -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);
}
}

View File

@@ -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);
}
}

View File

@@ -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);
}
}

View File

@@ -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);
}
}

View File

@@ -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);
}
}

View File

@@ -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);
}
}

View File

@@ -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);
}
}

View File

@@ -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);
}
}

View File

@@ -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);
}
}