Add another standard C++ prototype for string::compare.

This commit is contained in:
Adrien Destugues 2013-01-05 11:19:40 +01:00 committed by Oliver Tappe
parent a060af0916
commit 24ebe81445

View File

@ -408,17 +408,18 @@ public:
basic_string substr (size_type pos = 0, size_type n = npos) const
{ return basic_string (*this, pos, n); }
int compare (const basic_string& str, size_type pos = 0, size_type n = npos) const;
// There is no 'strncmp' equivalent for charT pointers.
// BeOS bogus version
int compare (const charT* s, size_type pos, size_type n) const;
int compare (const basic_string& str, size_type pos = 0, size_type n = npos) const;
// There is no 'strncmp' equivalent for charT pointers.
// Correct std C++ prototype
int compare (size_type pos, size_type n, const charT* s) const
{ return compare(s, pos, n); }
int compare (const charT* s, size_type pos = 0) const
{ return compare (s, pos, traits::length (s)); }
int compare (size_type pos, size_type n, const basic_string& str) const
{ return compare(str, pos, n); }
iterator begin () { selfish (); return &(*this)[0]; }
iterator end () { selfish (); return &(*this)[length ()]; }