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
- The C++ Standard Library - A Tutorial and Reference
- C++ Core Guidelines
- The C++ Tutorial | Learn C++
- https://cppreference.com/
- All C++20 core language features with examples | Oleksandr Koval’s blog
-- Frank Dean - 10 Jun 2012