Effective STL item 48. Always include the proper headers.
Include corresponding header when you use container.
All but four algorithms are declared in <algorithm>.
inner_product, adjacent_differene, partial_sum and accumulate
are in the <numeric>.
Special kinds of iterators , including istream_iterators are in the
<iterator>
Standard functors, eg less<T> and functor adapter not1, bind2nd
are declared in <functional>. They are not recommended to use in
C++11. Because C++ 11 introduce function and bind template.
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/