Remove redundant comparison operators
Since C++20 (a != b) get automatically rewritten as !(a == b) if the != operator does not exist.
This commit is contained in:
parent
d1c8622dc7
commit
96884193dd
|
@ -69,11 +69,6 @@ constexpr bool operator==(Color lhs, Color rhs)
|
||||||
lhs.r == rhs.r and lhs.g == rhs.g and lhs.b == rhs.b;
|
lhs.r == rhs.r and lhs.g == rhs.g and lhs.b == rhs.b;
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr bool operator!=(Color lhs, Color rhs)
|
|
||||||
{
|
|
||||||
return not (lhs == rhs);
|
|
||||||
}
|
|
||||||
|
|
||||||
Color str_to_color(StringView color);
|
Color str_to_color(StringView color);
|
||||||
String to_string(Color color);
|
String to_string(Color color);
|
||||||
|
|
||||||
|
|
|
@ -33,8 +33,6 @@ struct JumpList
|
||||||
return lhs.m_jumps == rhs.m_jumps and lhs.m_current == rhs.m_current;
|
return lhs.m_jumps == rhs.m_jumps and lhs.m_current == rhs.m_current;
|
||||||
}
|
}
|
||||||
|
|
||||||
friend bool operator!=(const JumpList& lhs, const JumpList& rhs) { return not (lhs == rhs); }
|
|
||||||
|
|
||||||
size_t current_index() const { return m_current; }
|
size_t current_index() const { return m_current; }
|
||||||
|
|
||||||
ConstArrayView<SelectionList> get_as_list() const { return m_jumps; }
|
ConstArrayView<SelectionList> get_as_list() const { return m_jumps; }
|
||||||
|
|
|
@ -41,11 +41,6 @@ struct Face
|
||||||
lhs.attributes == rhs.attributes;
|
lhs.attributes == rhs.attributes;
|
||||||
}
|
}
|
||||||
|
|
||||||
friend constexpr bool operator!=(const Face& lhs, const Face& rhs)
|
|
||||||
{
|
|
||||||
return not (lhs == rhs);
|
|
||||||
}
|
|
||||||
|
|
||||||
friend constexpr size_t hash_value(const Face& val)
|
friend constexpr size_t hash_value(const Face& val)
|
||||||
{
|
{
|
||||||
return hash_values(val.fg, val.bg, val.underline, val.attributes);
|
return hash_values(val.fg, val.bg, val.underline, val.attributes);
|
||||||
|
|
|
@ -103,11 +103,6 @@ constexpr bool operator==(const timespec& lhs, const timespec& rhs)
|
||||||
return lhs.tv_sec == rhs.tv_sec and lhs.tv_nsec == rhs.tv_nsec;
|
return lhs.tv_sec == rhs.tv_sec and lhs.tv_nsec == rhs.tv_nsec;
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr bool operator!=(const timespec& lhs, const timespec& rhs)
|
|
||||||
{
|
|
||||||
return not (lhs == rhs);
|
|
||||||
}
|
|
||||||
|
|
||||||
enum class FilenameFlags
|
enum class FilenameFlags
|
||||||
{
|
{
|
||||||
None = 0,
|
None = 0,
|
||||||
|
|
|
@ -39,7 +39,6 @@ struct TestableFlags
|
||||||
constexpr operator UnderlyingType<Flags>() const { return (UnderlyingType<Flags>)value; }
|
constexpr operator UnderlyingType<Flags>() const { return (UnderlyingType<Flags>)value; }
|
||||||
|
|
||||||
constexpr bool operator==(const TestableFlags<Flags>& other) const { return value == other.value; }
|
constexpr bool operator==(const TestableFlags<Flags>& other) const { return value == other.value; }
|
||||||
constexpr bool operator!=(const TestableFlags<Flags>& other) const { return value != other.value; }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
template<WithBitOps Flags>
|
template<WithBitOps Flags>
|
||||||
|
|
|
@ -354,12 +354,6 @@ struct HashMap
|
||||||
return size() == other.size() and std::equal(begin(), end(), other.begin());
|
return size() == other.size() and std::equal(begin(), end(), other.begin());
|
||||||
}
|
}
|
||||||
|
|
||||||
template<MemoryDomain otherDomain>
|
|
||||||
constexpr bool operator!=(const HashMap<Key, Value, otherDomain, Container>& other) const
|
|
||||||
{
|
|
||||||
return not (*this == other);
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static auto& item_value(auto& item)
|
static auto& item_value(auto& item)
|
||||||
{
|
{
|
||||||
|
|
|
@ -28,9 +28,6 @@ struct InsertCompleterDesc
|
||||||
bool operator==(const InsertCompleterDesc& other) const
|
bool operator==(const InsertCompleterDesc& other) const
|
||||||
{ return mode == other.mode and param == other.param; }
|
{ return mode == other.mode and param == other.param; }
|
||||||
|
|
||||||
bool operator!=(const InsertCompleterDesc& other) const
|
|
||||||
{ return not (*this == other); }
|
|
||||||
|
|
||||||
Mode mode;
|
Mode mode;
|
||||||
Optional<String> param;
|
Optional<String> param;
|
||||||
};
|
};
|
||||||
|
@ -62,7 +59,7 @@ struct InsertCompletion
|
||||||
DisplayLine menu_entry;
|
DisplayLine menu_entry;
|
||||||
|
|
||||||
bool operator==(const Candidate& other) const { return completion == other.completion; }
|
bool operator==(const Candidate& other) const { return completion == other.completion; }
|
||||||
bool operator<(const Candidate& other) const { return completion < other.completion; }
|
auto operator<=>(const Candidate& other) const { return completion <=> other.completion; }
|
||||||
};
|
};
|
||||||
using CandidateList = Vector<Candidate, MemoryDomain::Completion>;
|
using CandidateList = Vector<Candidate, MemoryDomain::Completion>;
|
||||||
|
|
||||||
|
|
|
@ -132,13 +132,6 @@ constexpr bool operator==(const Allocator<T1, d1>&, const Allocator<T2, d2>&)
|
||||||
return d1 == d2;
|
return d1 == d2;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T1, MemoryDomain d1, typename T2, MemoryDomain d2>
|
|
||||||
constexpr bool operator!=(const Allocator<T1, d1>&, const Allocator<T2, d2>&)
|
|
||||||
{
|
|
||||||
return d1 != d2;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
constexpr MemoryDomain memory_domain(Meta::AnyType) { return MemoryDomain::Undefined; }
|
constexpr MemoryDomain memory_domain(Meta::AnyType) { return MemoryDomain::Undefined; }
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
|
|
|
@ -62,11 +62,6 @@ struct PrefixedList
|
||||||
{
|
{
|
||||||
return lhs.prefix == rhs.prefix and lhs.list == rhs.list;
|
return lhs.prefix == rhs.prefix and lhs.list == rhs.list;
|
||||||
}
|
}
|
||||||
|
|
||||||
friend bool operator!=(const PrefixedList& lhs, const PrefixedList& rhs)
|
|
||||||
{
|
|
||||||
return not (lhs == rhs);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
|
|
|
@ -57,8 +57,6 @@ public:
|
||||||
(not m_valid or m_value == other.m_value);
|
(not m_valid or m_value == other.m_value);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator!=(const Optional& other) const { return !(*this == other); }
|
|
||||||
|
|
||||||
template<typename... Args>
|
template<typename... Args>
|
||||||
T& emplace(Args&&... args)
|
T& emplace(Args&&... args)
|
||||||
{
|
{
|
||||||
|
|
|
@ -117,11 +117,6 @@ struct ParametersParser
|
||||||
return m_index == other.m_index;
|
return m_index == other.m_index;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator!=(const iterator& other) const
|
|
||||||
{
|
|
||||||
return not (*this == other);
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const ParametersParser& m_parser;
|
const ParametersParser& m_parser;
|
||||||
size_t m_index;
|
size_t m_index;
|
||||||
|
|
|
@ -15,10 +15,6 @@ struct Range
|
||||||
return lhs.begin == rhs.begin and lhs.end == rhs.end;
|
return lhs.begin == rhs.begin and lhs.end == rhs.end;
|
||||||
}
|
}
|
||||||
|
|
||||||
friend bool operator!=(const Range& lhs, const Range& rhs)
|
|
||||||
{
|
|
||||||
return not (lhs == rhs);
|
|
||||||
}
|
|
||||||
|
|
||||||
friend size_t hash_value(const Range& range)
|
friend size_t hash_value(const Range& range)
|
||||||
{
|
{
|
||||||
|
|
|
@ -145,11 +145,6 @@ struct FilterView
|
||||||
return lhs.m_it == rhs.m_it;
|
return lhs.m_it == rhs.m_it;
|
||||||
}
|
}
|
||||||
|
|
||||||
friend bool operator!=(const Iterator& lhs, const Iterator& rhs)
|
|
||||||
{
|
|
||||||
return not (lhs == rhs);
|
|
||||||
}
|
|
||||||
|
|
||||||
const RangeIt& base() const { return m_it; }
|
const RangeIt& base() const { return m_it; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -205,11 +200,6 @@ struct EnumerateView
|
||||||
return lhs.m_it == rhs.m_it;
|
return lhs.m_it == rhs.m_it;
|
||||||
}
|
}
|
||||||
|
|
||||||
friend bool operator!=(const Iterator& lhs, const Iterator& rhs)
|
|
||||||
{
|
|
||||||
return not (lhs == rhs);
|
|
||||||
}
|
|
||||||
|
|
||||||
const RangeIt& base() const { return m_it; }
|
const RangeIt& base() const { return m_it; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -264,7 +254,6 @@ struct TransformView
|
||||||
Iterator operator-(difference_type diff) const { return {*m_transform, m_it - diff}; }
|
Iterator operator-(difference_type diff) const { return {*m_transform, m_it - diff}; }
|
||||||
|
|
||||||
friend bool operator==(const Iterator& lhs, const Iterator& rhs) { return lhs.m_it == rhs.m_it; }
|
friend bool operator==(const Iterator& lhs, const Iterator& rhs) { return lhs.m_it == rhs.m_it; }
|
||||||
friend bool operator!=(const Iterator& lhs, const Iterator& rhs) { return not (lhs == rhs); }
|
|
||||||
friend difference_type operator-(const Iterator& lhs, const Iterator& rhs) { return lhs.m_it - rhs.m_it; }
|
friend difference_type operator-(const Iterator& lhs, const Iterator& rhs) { return lhs.m_it - rhs.m_it; }
|
||||||
|
|
||||||
RangeIt base() const { return m_it; }
|
RangeIt base() const { return m_it; }
|
||||||
|
@ -350,7 +339,6 @@ struct SplitView
|
||||||
Iterator operator++(int) { auto copy = *this; advance(); return copy; }
|
Iterator operator++(int) { auto copy = *this; advance(); return copy; }
|
||||||
|
|
||||||
bool operator==(const Iterator& other) const { return pos == other.pos and done == other.done; }
|
bool operator==(const Iterator& other) const { return pos == other.pos and done == other.done; }
|
||||||
bool operator!=(const Iterator& other) const { return pos != other.pos or done != other.done; }
|
|
||||||
|
|
||||||
ValueType operator*() { return {pos, (not include_separator or sep == end) ? sep : sep + 1}; }
|
ValueType operator*() { return {pos, (not include_separator or sep == end) ? sep : sep + 1}; }
|
||||||
|
|
||||||
|
@ -528,11 +516,6 @@ struct ConcatView
|
||||||
lhs.m_it2 == rhs.m_it2;
|
lhs.m_it2 == rhs.m_it2;
|
||||||
}
|
}
|
||||||
|
|
||||||
friend bool operator!=(const Iterator& lhs, const Iterator& rhs)
|
|
||||||
{
|
|
||||||
return not (lhs == rhs);
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool is2() const { return m_it1 == m_end1; }
|
bool is2() const { return m_it1 == m_end1; }
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,6 @@ public:
|
||||||
explicit Regex(StringView re, RegexCompileFlags flags = RegexCompileFlags::None);
|
explicit Regex(StringView re, RegexCompileFlags flags = RegexCompileFlags::None);
|
||||||
bool empty() const { return m_str.empty(); }
|
bool empty() const { return m_str.empty(); }
|
||||||
bool operator==(const Regex& other) const { return m_str == other.m_str; }
|
bool operator==(const Regex& other) const { return m_str == other.m_str; }
|
||||||
bool operator!=(const Regex& other) const { return m_str != other.m_str; }
|
|
||||||
|
|
||||||
const String& str() const { return m_str; }
|
const String& str() const { return m_str; }
|
||||||
|
|
||||||
|
@ -62,7 +61,6 @@ struct MatchResults
|
||||||
SubMatch operator*() const { return {*m_it, *(m_it+1)}; }
|
SubMatch operator*() const { return {*m_it, *(m_it+1)}; }
|
||||||
|
|
||||||
friend bool operator==(const iterator& lhs, const iterator& rhs) { return lhs.m_it == rhs.m_it; }
|
friend bool operator==(const iterator& lhs, const iterator& rhs) { return lhs.m_it == rhs.m_it; }
|
||||||
friend bool operator!=(const iterator& lhs, const iterator& rhs) { return lhs.m_it != rhs.m_it; }
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
It m_it;
|
It m_it;
|
||||||
|
@ -90,11 +88,6 @@ struct MatchResults
|
||||||
return lhs.m_values == rhs.m_values;
|
return lhs.m_values == rhs.m_values;
|
||||||
}
|
}
|
||||||
|
|
||||||
friend bool operator!=(const MatchResults& lhs, const MatchResults& rhs)
|
|
||||||
{
|
|
||||||
return not (lhs == rhs);
|
|
||||||
}
|
|
||||||
|
|
||||||
void swap(MatchResults& other)
|
void swap(MatchResults& other)
|
||||||
{
|
{
|
||||||
m_values.swap(other.m_values);
|
m_values.swap(other.m_values);
|
||||||
|
@ -192,7 +185,6 @@ struct RegexIterator
|
||||||
|
|
||||||
It& operator++() { m_valid = m_base.next(); return *this; }
|
It& operator++() { m_valid = m_base.next(); return *this; }
|
||||||
bool operator==(Sentinel) const { return not m_valid; }
|
bool operator==(Sentinel) const { return not m_valid; }
|
||||||
bool operator!=(Sentinel) const { return m_valid; }
|
|
||||||
|
|
||||||
RegexIterator& m_base;
|
RegexIterator& m_base;
|
||||||
bool m_valid;
|
bool m_valid;
|
||||||
|
|
|
@ -127,7 +127,6 @@ struct SelectionList
|
||||||
size_t size() const { return m_selections.size(); }
|
size_t size() const { return m_selections.size(); }
|
||||||
|
|
||||||
bool operator==(const SelectionList& other) const { return m_buffer == other.m_buffer and m_selections == other.m_selections; }
|
bool operator==(const SelectionList& other) const { return m_buffer == other.m_buffer and m_selections == other.m_selections; }
|
||||||
bool operator!=(const SelectionList& other) const { return not ((*this) == other); }
|
|
||||||
|
|
||||||
void sort();
|
void sort();
|
||||||
void merge_overlapping();
|
void merge_overlapping();
|
||||||
|
|
|
@ -341,14 +341,10 @@ inline bool operator==(const StringView& lhs, const StringView& rhs)
|
||||||
std::equal(lhs.begin(), lhs.end(), rhs.begin());
|
std::equal(lhs.begin(), lhs.end(), rhs.begin());
|
||||||
}
|
}
|
||||||
|
|
||||||
[[gnu::always_inline]]
|
inline auto operator<=>(const StringView& lhs, const StringView& rhs)
|
||||||
inline bool operator!=(const StringView& lhs, const StringView& rhs)
|
|
||||||
{ return not (lhs == rhs); }
|
|
||||||
|
|
||||||
inline bool operator<(const StringView& lhs, const StringView& rhs)
|
|
||||||
{
|
{
|
||||||
return std::lexicographical_compare(lhs.begin(), lhs.end(),
|
return std::lexicographical_compare_three_way(lhs.begin(), lhs.end(),
|
||||||
rhs.begin(), rhs.end());
|
rhs.begin(), rhs.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
inline String operator"" _str(const char* str, size_t)
|
inline String operator"" _str(const char* str, size_t)
|
||||||
|
|
|
@ -82,8 +82,6 @@ struct WrapView
|
||||||
Iterator operator++(int) { auto copy = *this; ++(*this); return copy; }
|
Iterator operator++(int) { auto copy = *this; ++(*this); return copy; }
|
||||||
|
|
||||||
bool operator==(Iterator other) const { return m_remaining == other.m_remaining and m_current == other.m_current; }
|
bool operator==(Iterator other) const { return m_remaining == other.m_remaining and m_current == other.m_current; }
|
||||||
bool operator!=(Iterator other) const { return not (*this == other); }
|
|
||||||
|
|
||||||
StringView operator*() { return m_current; }
|
StringView operator*() { return m_current; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -69,7 +69,6 @@ struct TerminalUI::Window::Line
|
||||||
}
|
}
|
||||||
|
|
||||||
friend bool operator==(const Atom& lhs, const Atom& rhs) { return lhs.text == rhs.text and lhs.skip == rhs.skip and lhs.face == rhs.face; }
|
friend bool operator==(const Atom& lhs, const Atom& rhs) { return lhs.text == rhs.text and lhs.skip == rhs.skip and lhs.face == rhs.face; }
|
||||||
friend bool operator!=(const Atom& lhs, const Atom& rhs) { return not (lhs == rhs); }
|
|
||||||
friend size_t hash_value(const Atom& atom) { return hash_values(atom.text, atom.skip, atom.face); }
|
friend size_t hash_value(const Atom& atom) { return hash_values(atom.text, atom.skip, atom.face); }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -100,12 +100,12 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator==(const iterator& other) const noexcept { return m_it == other.m_it; }
|
bool operator==(const iterator& other) const noexcept { return m_it == other.m_it; }
|
||||||
auto operator<=> (const iterator& other) const noexcept { return m_it <=> other.m_it; }
|
auto operator<=>(const iterator& other) const noexcept { return m_it <=> other.m_it; }
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
requires std::is_same_v<T, BaseIt> or std::is_same_v<T, Sentinel>
|
requires std::is_same_v<T, BaseIt> or std::is_same_v<T, Sentinel>
|
||||||
bool operator==(const T& other) const noexcept { return m_it == other; }
|
bool operator==(const T& other) const noexcept { return m_it == other; }
|
||||||
auto operator<=> (const BaseIt& other) const noexcept { return m_it <=> other; }
|
auto operator<=>(const BaseIt& other) const noexcept { return m_it <=> other; }
|
||||||
|
|
||||||
DifferenceType operator-(const iterator& other) const noexcept(noexcept_policy)
|
DifferenceType operator-(const iterator& other) const noexcept(noexcept_policy)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue
Block a user