Tech > C++_STL_Notes

C++ Standard Template Library Notes

Iterators

For an iterator to remain independent of the container type, the comparison with the end() method may use the != operator rather than the < operator, as the < operator is only implemented by random access containers. However, be careful to ensure that the iterator does not move to a position beyond end() when using the != operator.

E.g.

for (i = c.begin(); i != c.end(); ++i) { }

Streams

To avoid potentially expensive startup code in some implementations of <iostream>, only include the <iosfwd> header file, unless you specifically need definitions from <iostream>.

References

-- Frank Dean - 10 Jun 2012