devxlogo

October 18, 2000

Checking the State of a Stream

The iostream family of classes provides the following member functions and operators for checking the stream’s state: bool good() // returns true if no error flag is setbool eof() //

Comma Separated Expressions

An expression may consist of one or more subexpressions. You can group several expressions in one statement and separate them with commas. For example: if(++x, –y, cin.good()) // three expressions

The Semantics of const_iterator

A recent subscriber of one of the C++ newsgroups posted the following question:Why did the C++ standardization committee created a const_iterator instead of a const iterator? Or, at least, why

Treating a Vector As an Array

In certain contexts, you have to treat a vector as an array of its elements. For example, suppose you have a function that takes int * as its argument. How

The erase() Member Function of Associative Containers

The associative containers std::map, std::multimap, std::set, and std::multiset have the following three overloaded forms of the member function erase(): class map // simplified for brevity{public://..other members void erase(iterator position); //