The biggest place I've seen this is with C++11, which included most of the Technical Report 1 libraries. For example, to access the hash table (unordered_map
), you used to have to #include <tr1/unordered_map>
and it was in the namespace std::tr1
. Now, you just leave the tr1 off of both.
The C++ standard has been revised several times, the most recent being C++11, C++03, and C++98. However, few compilers implement the full spec in one release, so different releases of different compilers support different parts of the spec. Plus, since the spec is written in a natural language (English), it has ambiguities, and corner cases can be handled differently by different compilers.
Similarly, in one implementation of the standard library, #include <vector>
may automatically #include <algorithm>
, whereas in another, it may not. So in one implementation, you might be able to get away with using the methods in algorithm
without including it, even though your program does not technically conform to the C++ spec.
As for the primary standardization, if you're starting a project from scratch now, you should use C++11 and the latest stable release of your favourite compiler. Not all features are fully implemented by all compilers, but e.g. you should use unique_ptr
instead of auto_ptr
, use (simple) lambdas, and the auto
keyword where it improves readability.