Allow sort keys to contain nothing but a single NUL character (characters may be ignorable).

[SVN r27408]
This commit is contained in:
John Maddock
2005-02-17 12:44:16 +00:00
parent 077f211f2f
commit ecd5dd5ff3
7 changed files with 41 additions and 6 deletions

View File

@@ -68,11 +68,25 @@ inline bool can_start(wchar_t c, const unsigned char* map, unsigned char mask)
#ifndef _RWSTD_VER
template <class C, class T, class A>
inline int string_compare(const std::basic_string<C,T,A>& s, const C* p)
{ return s.compare(p); }
{
if(0 == *p)
{
if(s.empty() || ((s.size() == 1) && (s[0] == 0)))
return 0;
}
return s.compare(p);
}
#else
template <class C, class T, class A>
inline int string_compare(const std::basic_string<C,T,A>& s, const C* p)
{ return s.compare(p); }
{
if(0 == *p)
{
if(s.empty() || ((s.size() == 1) && (s[0] == 0)))
return 0;
}
return s.compare(p);
}
inline int string_compare(const std::string& s, const char* p)
{ return std::strcmp(s.c_str(), p); }
# ifndef BOOST_NO_WREGEX