From: Rodeo Red 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: 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 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit 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 #include 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 *, 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,__default_alloc_template > &' c:/djgpp/lang/cxx/stl_algo.h:472: `const class basic_string,__default_alloc_template >' used where a `char' was expected