delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/11/02/06:45:13

From: Rodeo Red <rodeored AT netstep DOT net>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: compare()
Date: Thu, 02 Nov 2000 05:52:59 -0500
Organization: Church of Evangelical Environmental Extremism
Lines: 52
Message-ID: <E80A6618268722F2.334C4577FE04F5AA.3D933E68350DF73B@lp.airnews.net>
X-Orig-Message-ID: <3A01478B DOT 7DD4DD67 AT netstep DOT net>
References: <1F7509A3BB20243A DOT 7FD3AC2DC483DD04 DOT 6BB6DE9721314E90 AT lp DOT airnews DOT net> <39fea8f5 DOT 9349153 AT news DOT freeserve DOT net> <2D3CEFEF9F5772C9 DOT 21D15067E7ACE130 DOT 3275BE6B77FD834E AT lp DOT airnews DOT net> <39fecce1 DOT 18547083 AT news DOT freeserve DOT net>
Abuse-Reports-To: support at netstep.net to report improper postings
NNTP-Proxy-Relay: library1-aux.airnews.net
NNTP-Posting-Time: Thu Nov 2 04:42:49 2000
NNTP-Posting-Host: !Y^hD-@[-WZWnL& (Encoded at Airnews!)
Mime-Version: 1.0
X-Mailer: Mozilla 4.7 [en] (Win98; I)
X-Accept-Language: en
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Steamer wrote:
> > > 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.

Ok Thanks for setting me straight. 

Now Ive got a similar problem with replace() and I don't know if this is
the same situation. How do I tell if my function is not supported ? I'd
like to be able to know, because if it is supported, the error is
probably mine.  
This is based on the example on page 1173 pf c++ Primer by Lippman and
Lajoie, a reliable text. 

#include <string>
#include <algorithm>

int main()
{
    string str = "The rain in Spain falls mainly on the plain\n";
    cout << "string:"<< str;
    string oldval = "rain";
    string newval = "sleet";
    replace (str.begin(), str.end(), oldval, newval) ;
    cout << "new str:"<< str;
}

I get these messages:
c:/djgpp/lang/cxx/stl_algo.h: In function `void replace<char *,
string>(char *, char *, const string &, const string &)':
replace.cpp:11:   instantiated from here
c:/djgpp/lang/cxx/stl_algo.h:471: no match for `char & == const
basic_string<char,string_char_traits<char>,__default_alloc_template<false,0>
> &'
c:/djgpp/lang/cxx/stl_algo.h:472: `const class
basic_string<char,string_char_traits<char>,__default_alloc_template<false,0>
>' used where a `char' was expected

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019