dcsimg
Login | Register   
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.


Tip of the Day
Language: C++
Expertise: Beginner
May 19, 2000

WEBINAR:

On-Demand

Application Security Testing: An Integral Part of DevOps


Problem with Streams

Question:
Why does a simple program such as the following produce compilation errors?
#include
#include
using namespace std;
int main()
{
  ostream_iterator os(cout);
  vector vi(3,0);
  os=vi[0];
  os++;
  os=vi[1];
  return 0;
}
I use the Microsoft Visual Studio compiler and it gives me an error message: ostream_iterator:undeclared identifier.

Please help.

Answer:
There's a bug in Visual C++. Your code is fine (except for the misspelled header file). If you're using advanced STL features such as stream iterators, my advice is to use a more standard-compliant compiler.

DevX Pro
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date