From: "Alex Vinokur" 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: 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 #include #include #include #include using namespace std; // ============================== int main (int argc, char** argv) { string file_line; if (!(argc > 1)) { cout << "FATAL ERROR !" << endl; cout << " Usage : " << argv[0] << " " << "" << 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 file_vline; istringstream isstr (file_line.c_str ()); copy( istream_iterator(isstr), istream_iterator (), back_inserter (file_vline) ); cout << "\t Line#" << i << " ---> "; copy ( file_vline.begin (), file_vline.end (), ostream_iterator (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 ==================