This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: RedHat 8.0 `istream_iterator' undeclared (first use this function)
- From: LLeweLLyn Reese <llewelly at lifesupport dot shutdown dot com>
- To: MR <nimrod dot bm at optusnet dot com dot au>
- Cc: gcc-help at gcc dot gnu dot org
- Date: 24 May 2003 05:46:26 -0700
- Subject: Re: RedHat 8.0 `istream_iterator' undeclared (first use this function)
- References: <20030224045442.GA25932@uol.com.br><1053775198.2190.10.camel@nimrod>
MR <nimrod.bm@optusnet.com.au> writes:
> Hello STL gurus,
>
>
> I have a bit of a problem getting my iterators to work with libstdc++
> 3.2-7 (redhat 8.0), GCC 3.2.
>
> with a very simple program (merges two files):
>
> #include <iostream>
> #include <fstream>
> #include <algorithm>
#include <iterator>
Stream iterators are in this header. See the <iterator> synopsis in
24.2, or 24.5 .
>
> using namespace std;
>
> main(int argc, char**argv) {
int main(int argc, char**argv) {
> if (argc < 3) {
>
> cout << "You must supply two input files.\n";
>
> exit(1);
> }
>
> ifstream in1(argv[1]), in2(argv[2]);
> if(!in1||!in2) {
> cout << "File open error\n";
> exit(1);
> }
>
> merge(
> istream_iterator<float>(in1),
> istream_iterator<float>(),
> istream_iterator<float>(in2),
> istream_iterator<float>(),
> ostream_iterator<float>(cout, "\n")
> );
> return 0;
> }