Update equality overloads for C++20

C++20 added new reverse and rewritten candidates. This can confuse the compiler because it'll test both A==B and B==A for overloads.
Because we were defining parent class equality overloads, A==B and B==A was considered ambigious due to both being compatible in casting.

So we needed to add explicit child class equality operator overloads
This commit is contained in:
Marek Roszko
2024-04-12 23:05:58 -04:00
parent 7a67151a22
commit 96cdfc7fa7
17 changed files with 98 additions and 45 deletions
+8 -4
View File
@@ -140,7 +140,6 @@ double PCB_TABLECELL::Similarity( const BOARD_ITEM& aBoardItem ) const
return similarity;
}
bool PCB_TABLECELL::operator==( const BOARD_ITEM& aBoardItem ) const
{
if( aBoardItem.Type() != Type() )
@@ -148,9 +147,14 @@ bool PCB_TABLECELL::operator==( const BOARD_ITEM& aBoardItem ) const
const PCB_TABLECELL& other = static_cast<const PCB_TABLECELL&>( aBoardItem );
return m_colSpan == other.m_colSpan
&& m_rowSpan == other.m_rowSpan
&& PCB_TEXTBOX::operator==( other );
return *this == other;
}
bool PCB_TABLECELL::operator==( const PCB_TABLECELL& aOther ) const
{
return m_colSpan == aOther.m_colSpan
&& m_rowSpan == aOther.m_rowSpan
&& PCB_TEXTBOX::operator==( aOther );
}