public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* c++/5792: g++ fails with functions as arguments
@ 2002-02-28 10:46 cagdasozgenc
0 siblings, 0 replies; 2+ messages in thread
From: cagdasozgenc @ 2002-02-28 10:46 UTC (permalink / raw)
To: gcc-gnats
>Number: 5792
>Category: c++
>Synopsis: g++ fails with functions as arguments
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: rejects-legal
>Submitter-Id: net
>Arrival-Date: Thu Feb 28 09:56:00 PST 2002
>Closed-Date:
>Last-Modified:
>Originator: cagdasozgenc@hotmail.com
>Release: 3.0.4
>Organization:
>Environment:
redhat linux 7.2 dual pentium 800Mhz
>Description:
#include <map>
#include <fstream>
#include <iostream>
#include <iomanip>
#include <string>
#include <algorithm>
using namespace std;
typedef map<string,int> Index;
int main(int argc, char* argv[]) {
Index index;
ifstream ifs(argv[1]);
string word;
while(ifs >> word) {
transform(word.begin(),word.end(),word.begin(),tolower);
index[word]++;
}
cout.setf(ios::left);
for(Index::const_iterator i = index.begin(); i != index.end(); ++i) {
cout << setw(20) << i->first << " : " << i -> second << endl;
}
return 0;
}
transform function won't accept to lower without a typecast.
for_each function will not work either for the same reason.
>How-To-Repeat:
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: c++/5792: g++ fails with functions as arguments
@ 2002-06-05 8:55 lerdsuwa
0 siblings, 0 replies; 2+ messages in thread
From: lerdsuwa @ 2002-06-05 8:55 UTC (permalink / raw)
To: cagdasozgenc, gcc-bugs, gcc-prs, nobody
Synopsis: g++ fails with functions as arguments
State-Changed-From-To: open->closed
State-Changed-By: lerdsuwa
State-Changed-When: Wed Jun 5 08:55:14 2002
State-Changed-Why:
Not a bug. There are overloading functions of tolower:
int tolower(int);
and
template<class T> T tolower(T, const locale&);
that match the argument of transform.
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=5792
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2002-06-05 15:55 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-02-28 10:46 c++/5792: g++ fails with functions as arguments cagdasozgenc
2002-06-05 8:55 lerdsuwa
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).