Mail Archives: djgpp/2002/08/10/08:15:20
From: | "Alex Vinokur" <alexvn AT bigfoot DOT com>
|
Newsgroups: | comp.os.msdos.djgpp,comp.lang.c++
|
Subject: | istream_iterator, ostream_iterator and gcc/gpp-3.1
|
Date: | 10 Aug 2002 12:06:13 GMT
|
Lines: | 104
|
Message-ID: | <aj2vjj$178ktl$1@ID-79865.news.dfncis.de>
|
NNTP-Posting-Host: | pop03-2-ras1-p17.barak.net.il (212.150.97.17)
|
X-Trace: | fu-berlin.de 1028981173 41178037 212.150.97.17 (16 [79865])
|
X-Priority: | 3
|
X-MSMail-Priority: | Normal
|
X-Newsreader: | Microsoft Outlook Express 5.50.4522.1200
|
X-MimeOLE: | Produced By Microsoft MimeOLE V5.50.4522.1200
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
Reply-To: | djgpp AT delorie DOT com
|
============
Windows 2000
DJGPP 2.03
gcc/gpp 3.1
============
The code below has no problem with gcc/gpp 3.0.4.
However it does have a problem with gcc/gpp 3.1.
What has been changed concerning istream_iterator and ostream_iterator ?
######### C++ code : BEGIN #########
// File t1.cpp
#include <string>
#include <vector>
#include <sstream>
#include <iostream>
#include <fstream>
using namespace std;
// ==============================
int main (int argc, char** argv)
{
string file_line;
if (!(argc > 1))
{
cout << "FATAL ERROR !"
<< endl;
cout << " Usage : "
<< argv[0]
<< " "
<< "<Data-File-Name>"
<< endl;
return 1;
}
assert (argc > 1);
ifstream fin (argv[1]);
assert (fin);
cout << endl;
cout << "\t-----------------------" << endl;
cout << "\t--- File " << argv[1] << endl;
cout << "\t-----------------------" << endl;
for (int i = 1; getline (fin, file_line); i++)
{
vector<string> file_vline;
istringstream isstr (file_line.c_str ());
copy(
istream_iterator<string>(isstr),
istream_iterator<string> (),
back_inserter (file_vline)
);
cout << "\t Line#" << i << " ---> ";
copy (
file_vline.begin (),
file_vline.end (),
ostream_iterator<string> (cout, " # ")
);
cout << endl;
} // while
cout << "\t-----------------------" << endl;
}
######### C++ code : END ###########
######### Compilation : BEGIN #########
%gpp t1.cpp
T1.CPP: In function `int main(int, char**)':
T1.CPP:43: `istream_iterator' undeclared (first use this function)
T1.CPP:43: (Each undeclared identifier is reported only once for each function
it appears in.)
T1.CPP:43: parse error before `>' token
T1.CPP:52: `ostream_iterator' undeclared (first use this function)
T1.CPP:52: parse error before `>' token
######### Compilation : END ###########
==================
Alex Vinokur
mailto:alexvn AT go DOT to
http://up.to/alexvn
==================
- Raw text -