E
Evyn
Hi,
Can someone tell me why I always get an error like "`ostream_iterator'
undeclared (first use this function) " when using ostream_iterator. I
have for example tried the following code taken from
http://www.camtp.uni-mb.si/books/Thinking-in-C++/Chapter04.html :
//: C04:Intset.cpp
// Simple use of STL set
#include <set>
#include <iostream>
using namespace std;
int main() {
set<int> intset;
for(int i = 0; i < 25; i++)
for(int j = 0; j < 10; j++)
// Try to insert multiple copies:
intset.insert(j);
// Print to output:
copy(intset.begin(), intset.end(),
TIA
ostream_iterator<int>(cout, "\n"));
} ///:~
Can someone tell me why I always get an error like "`ostream_iterator'
undeclared (first use this function) " when using ostream_iterator. I
have for example tried the following code taken from
http://www.camtp.uni-mb.si/books/Thinking-in-C++/Chapter04.html :
//: C04:Intset.cpp
// Simple use of STL set
#include <set>
#include <iostream>
using namespace std;
int main() {
set<int> intset;
for(int i = 0; i < 25; i++)
for(int j = 0; j < 10; j++)
// Try to insert multiple copies:
intset.insert(j);
// Print to output:
copy(intset.begin(), intset.end(),
TIA
ostream_iterator<int>(cout, "\n"));
} ///:~