Effective STL item 48. Always include the proper headers.
Include corresponding header when you use container.
All but four algorithms are decalred
in <algorithm>. inner_product, adjacent_dfferene, partial_sum
and accumulate are in the <numeric>.
Specail kinds of iterators , includeing istream_iterators are in the
<iterator>
Standard functors, eg less<T> and fuctor adapter not1, bind2nd
are declared in <functional>. They are not recommented to use
in C++11.
STL is a good example of generic programming, there is specific book about
topic of generic programming, if you have time in the future, you can look at
it.
Containers, iterators, functions objects, and algorithms four parts. Usefunctor customize algorithms, then apply algorithm on Containersby iterators. Such as algorithm find, you can input two Iterators into the
it. Find don’t care what container which he will look for a value in it. Find()
in fact is a template function, it doesn’t use inheritance to make
generic programming, but use template. All the idea is explained here:
http://www.cplusplus.com/reference/algorithm/for_each/