mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-31 21:15:33 +08:00
Fixed friend compare() method in CContainerBase
This commit is contained in:
committed by
Mathew Sutcliffe
parent
c5a2136ebd
commit
5fbf8a227d
@@ -61,9 +61,15 @@ namespace BlackMisc
|
||||
//! \copydoc BlackMisc::CValueObject::compare
|
||||
friend int compare(const C<T> &a, const C<T> &b)
|
||||
{
|
||||
for (auto i = a.cbegin(), j = b.cbegin(); i != a.cend() && j != b.cend(); ++i, ++j)
|
||||
{
|
||||
if (*i < *j) { return -1; }
|
||||
if (*j < *i) { return 1; }
|
||||
}
|
||||
if (a.size() < b.size()) { return -1; }
|
||||
if (a.size() > b.size()) { return 1; }
|
||||
return std::lexicographical_compare(a.cbegin(), a.cend(), b.cbegin(), b.cend());
|
||||
if (b.size() < a.size()) { return 1; }
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
/*!
|
||||
|
||||
Reference in New Issue
Block a user