Move comparison helper class to generic header
This class wraps the comparison function in a way that is compatible with std::map and std::set. This, too is generally useful, so it should be moved to the generic header. At the same time, the criterium for less-than is changed from "equal to -1" to "smaller than 0", because technically the comparison function may return other values.
This commit is contained in:
parent
88ccd787a4
commit
a7b102c366
|
@ -284,17 +284,6 @@ unsigned int DIALOG_LIB_EDIT_PIN_TABLE::DataViewModel::GetChildren( const wxData
|
|||
}
|
||||
|
||||
|
||||
namespace {
|
||||
class CompareLess
|
||||
{
|
||||
public:
|
||||
bool operator()( const wxString& lhs, const wxString& rhs )
|
||||
{
|
||||
return PinNumbers::Compare( lhs, rhs ) == -1;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
int DIALOG_LIB_EDIT_PIN_TABLE::DataViewModel::Compare( const wxDataViewItem& aItem1,
|
||||
const wxDataViewItem& aItem2,
|
||||
unsigned int aCol,
|
||||
|
@ -398,7 +387,7 @@ void DIALOG_LIB_EDIT_PIN_TABLE::DataViewModel::Group::GetValue( wxVariant& aValu
|
|||
}
|
||||
else
|
||||
{
|
||||
std::set<wxString, CompareLess> values;
|
||||
std::set<wxString, PinNumbers::less> values;
|
||||
|
||||
for( std::list<Pin*>::const_iterator i = m_Members.begin(); i != m_Members.end(); ++i )
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue