Mail Archives: djgpp/2000/10/30/09:02:53
From: | Rodeo Red <rodeored AT netstep DOT net>
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | compare()
|
Date: | Mon, 30 Oct 2000 01:02:05 -0500
|
Organization: | Church of Evangelical Environmental Extremism
|
Lines: | 41
|
Message-ID: | <1F7509A3BB20243A.7FD3AC2DC483DD04.6BB6DE9721314E90@lp.airnews.net>
|
X-Orig-Message-ID: | <39FD0EDD DOT 79F3DB6E AT netstep DOT net>
|
Abuse-Reports-To: | support at netstep.net to report improper postings
|
NNTP-Proxy-Relay: | library1-aux.airnews.net
|
NNTP-Posting-Time: | Sun Oct 29 23:52:30 2000
|
NNTP-Posting-Host: | !e3H[-@[/`hhcGR (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
|
On my djgpp compiler I get the error messages below, and I thought it
might be a compiler specific glitch. Does anyone know why this does not
compile ? It compares the last three letters of the word with a string.
int main()
{
std::string word = "babies";
std::string::size_type pos3 = word.size()-3;
std::string ies("ies");
std::cout << word << std::endl;
std::cout << ies << std::endl;
if (!word.compare(pos3, 3, ies))//line 16:no matching function
{
std::cout<< "yes the word ends in 'ies'";
}
std::cout << word << std::endl;
return 0;
}
djgpp compiler messages:test.cpp: In function `int main()':
test.cpp:16: no matching function for call to
`basic_string<char,string_char_traits<char>,__default_alloc_template<false,0>
>::compare (size_t &, int, string &)'
c:/djgpp/lang/cxx/std/bastring.cc:398: candidates are: int
basic_string<char,string_char_traits<char>,__default_alloc_template<false,0>
>::compare(const basic_string<char,string_char_traits<char>,__default_alloc_template<false,0> > &, long unsigned int = 0, long unsigned int = basic_string<charT,traits,Allocator>::npos) const
c:/djgpp/lang/cxx/std/bastring.cc:417: int
basic_string<char,string_char_traits<char>,__default_alloc_template<false,0>
>::compare(const char *, long unsigned int, long unsigned int) const
c:/djgpp/lang/cxx/std/bastring.h:394: int
basic_string<char,string_char_traits<char>,__default_alloc_template<false,0>
>::compare(const char *, long unsigned int = 0) const
- Raw text -