Default comparison operators that can be
This commit is contained in:
parent
96884193dd
commit
2fa55be40a
|
@ -28,10 +28,7 @@ struct JumpList
|
|||
const SelectionList& backward(Context& context, int count);
|
||||
void forget_buffer(Buffer& buffer);
|
||||
|
||||
friend bool operator==(const JumpList& lhs, const JumpList& rhs)
|
||||
{
|
||||
return lhs.m_jumps == rhs.m_jumps and lhs.m_current == rhs.m_current;
|
||||
}
|
||||
friend bool operator==(const JumpList& lhs, const JumpList& rhs) = default;
|
||||
|
||||
size_t current_index() const { return m_current; }
|
||||
|
||||
|
|
|
@ -33,13 +33,7 @@ struct Face
|
|||
Attribute attributes = Attribute::Normal;
|
||||
Color underline = Color::Default;
|
||||
|
||||
friend constexpr bool operator==(const Face& lhs, const Face& rhs)
|
||||
{
|
||||
return lhs.fg == rhs.fg and
|
||||
lhs.bg == rhs.bg and
|
||||
lhs.underline == rhs.underline and
|
||||
lhs.attributes == rhs.attributes;
|
||||
}
|
||||
friend constexpr bool operator==(const Face& lhs, const Face& rhs) = default;
|
||||
|
||||
friend constexpr size_t hash_value(const Face& val)
|
||||
{
|
||||
|
|
|
@ -38,7 +38,7 @@ struct TestableFlags
|
|||
constexpr operator Flags() const { return 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 = default;
|
||||
};
|
||||
|
||||
template<WithBitOps Flags>
|
||||
|
|
|
@ -10,12 +10,12 @@ namespace Kakoune
|
|||
|
||||
void register_highlighters();
|
||||
|
||||
struct InclusiveBufferRange{ BufferCoord first, last; };
|
||||
|
||||
inline bool operator==(const InclusiveBufferRange& lhs, const InclusiveBufferRange& rhs)
|
||||
struct InclusiveBufferRange
|
||||
{
|
||||
return lhs.first == rhs.first and lhs.last == rhs.last;
|
||||
}
|
||||
BufferCoord first, last;
|
||||
friend bool operator==(const InclusiveBufferRange& lhs, const InclusiveBufferRange& rhs) = default;
|
||||
};
|
||||
|
||||
String option_to_string(InclusiveBufferRange range);
|
||||
InclusiveBufferRange option_from_string(Meta::Type<InclusiveBufferRange>, StringView str);
|
||||
|
||||
|
|
|
@ -25,8 +25,7 @@ struct InsertCompleterDesc
|
|||
Line
|
||||
};
|
||||
|
||||
bool operator==(const InsertCompleterDesc& other) const
|
||||
{ return mode == other.mode and param == other.param; }
|
||||
bool operator==(const InsertCompleterDesc& other) const = default;
|
||||
|
||||
Mode mode;
|
||||
Optional<String> param;
|
||||
|
|
|
@ -88,12 +88,6 @@ Vector<LineModification> compute_line_modifications(const Buffer& buffer, size_t
|
|||
return res;
|
||||
}
|
||||
|
||||
bool operator==(const LineModification& lhs, const LineModification& rhs)
|
||||
{
|
||||
return lhs.old_line == rhs.old_line and lhs.new_line == rhs.new_line and
|
||||
lhs.num_removed == rhs.num_removed and lhs.num_added == rhs.num_added;
|
||||
}
|
||||
|
||||
void LineRangeSet::update(ConstArrayView<LineModification> modifs)
|
||||
{
|
||||
if (modifs.empty())
|
||||
|
|
|
@ -20,6 +20,8 @@ struct LineModification
|
|||
LineCount num_added; // number of lines added (including this one)
|
||||
|
||||
LineCount diff() const { return new_line - old_line + num_added - num_removed; }
|
||||
|
||||
friend bool operator==(const LineModification& lhs, const LineModification& rhs) = default;
|
||||
};
|
||||
|
||||
Vector<LineModification> compute_line_modifications(const Buffer& buffer, size_t timestamp);
|
||||
|
|
|
@ -58,10 +58,7 @@ struct PrefixedList
|
|||
P prefix;
|
||||
Vector<T, MemoryDomain::Options> list;
|
||||
|
||||
friend bool operator==(const PrefixedList& lhs, const PrefixedList& rhs)
|
||||
{
|
||||
return lhs.prefix == rhs.prefix and lhs.list == rhs.list;
|
||||
}
|
||||
friend bool operator==(const PrefixedList& lhs, const PrefixedList& rhs) = default;
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
|
|
|
@ -10,11 +10,7 @@ struct Range
|
|||
T begin;
|
||||
T end;
|
||||
|
||||
friend bool operator==(const Range& lhs, const Range& rhs)
|
||||
{
|
||||
return lhs.begin == rhs.begin and lhs.end == rhs.end;
|
||||
}
|
||||
|
||||
friend bool operator==(const Range& lhs, const Range& rhs) = default;
|
||||
|
||||
friend size_t hash_value(const Range& range)
|
||||
{
|
||||
|
|
|
@ -510,11 +510,7 @@ struct ConcatView
|
|||
Iterator& operator++() { if (is2()) ++m_it2; else ++m_it1; return *this; }
|
||||
Iterator operator++(int) { auto copy = *this; ++*this; return copy; }
|
||||
|
||||
friend bool operator==(const Iterator& lhs, const Iterator& rhs)
|
||||
{
|
||||
return lhs.m_it1 == rhs.m_it1 and lhs.m_end1 == rhs.m_end1 and
|
||||
lhs.m_it2 == rhs.m_it2;
|
||||
}
|
||||
friend bool operator==(const Iterator& lhs, const Iterator& rhs) = default;
|
||||
|
||||
private:
|
||||
bool is2() const { return m_it1 == m_end1; }
|
||||
|
|
|
@ -60,7 +60,7 @@ struct MatchResults
|
|||
iterator& operator++() { m_it += 2; return *this; }
|
||||
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) = default;
|
||||
private:
|
||||
|
||||
It m_it;
|
||||
|
@ -83,10 +83,7 @@ struct MatchResults
|
|||
SubMatch{m_values[i*2], m_values[i*2+1]} : SubMatch{};
|
||||
}
|
||||
|
||||
friend bool operator==(const MatchResults& lhs, const MatchResults& rhs)
|
||||
{
|
||||
return lhs.m_values == rhs.m_values;
|
||||
}
|
||||
friend bool operator==(const MatchResults& lhs, const MatchResults& rhs) = default;
|
||||
|
||||
void swap(MatchResults& other)
|
||||
{
|
||||
|
|
|
@ -68,7 +68,7 @@ struct TerminalUI::Window::Line
|
|||
text.resize(it - text.begin(), 0);
|
||||
}
|
||||
|
||||
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) = default;
|
||||
friend size_t hash_value(const Atom& atom) { return hash_values(atom.text, atom.skip, atom.face); }
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user