Mail Archives: djgpp/2000/10/31/09:00:15
Rodeo Red wrote:
> > The compare() member functions for std::string in GCC's C++ library
> > are non-standard.
>
> What exactly does that mean ?
>
> I'd guess you are saying that compare() is a standard C++ library
> function, except GCC doesn't include all the standard variations, such
> as :
> int compare(size_type pos1, size_type n1, const basic_string& str)
> const;
> but includes other versions, which arent standard, such as:
> int compare(const basic_string& str, size_type n1,)
That's right. The standard forms are these:
int compare(const basic_string& str) const;
int compare(size_type pos1, size_type n1, const basic_string& str) const;
int compare(size_type pos1, size_type n1, const basic_string& str, size_type pos2, size_type n2)
const;
int compare(const charT* s) const;
int compare(size_type pos1, size_type n1, const charT* s, size_type n2 = npos) const;
The current version of GCC's C++ library is missing some of these,
but has others with the arguments in a different order. (I've no
idea why this is.)
> > The code that Stan Moore posted obviously won't work with most C++
> > compilers.
>
>
> Well its not so obvious to me.:)
> Let me see if I got this straight
> He's using this form of compare:
> if (( pos3 > 0 ) && (word.compare(ies, pos3)))
>
> which would match:
> int compare(const basic_string& str, size_type n1,)
>
> Which does not match any compare() function in standard c++ but is
> included with djgpp.
>
> Correct ?
Correct.
- Raw text -