fix compare bug

git-svn-id: svn://svn.code.sf.net/p/loki-lib/code/trunk@639 7ec92016-0320-0410-acc4-a06ded1c099a
This commit is contained in:
syntheticpp 2006-04-18 09:27:35 +00:00
parent 85a490c387
commit cdc9205e8e

View file

@ -217,6 +217,8 @@ public:
private:
static size_type Min(size_type lhs, size_type rhs)
{ return lhs < rhs ? lhs : rhs; }
static size_type Max(size_type lhs, size_type rhs)
{ return lhs > rhs ? lhs : rhs; }
static void Procust(size_type& n, size_type nmax)
{ if (n > nmax) n = nmax; }
@ -1093,7 +1095,7 @@ public:
int compare(const value_type* s) const
{
return traits_type::compare(data(), s, traits_type::length(s));
return traits_type::compare(data(), s, Max(length(),traits_type::length(s)));
}
};