信息来源:邪恶八进制信息安全团队(
www.eviloctal.com)
Generic Programming and the C++ Standard
Library
One of C++'s most powerful features is its support for generic programming. This power is reflected
directly in the flexibility of the C++ standard library, especially in its containers, iterators, and
algorithms portion, originally known as the standard template library (STL).
This opening section focuses on how to make the best use of the C++ standard library, particularly the
STL. When and how can you make best use of std::vector and std::deque? What pitfalls
might you encounter when using std::map and std::set, and how can you safely avoid them?
Why doesn't std::remove() actually remove anything?
This section also highlights some useful techniques, as well as pitfalls, that occur when writing
generic code of your own, including code that's meant to work with and extend the STL. What kinds
of predicates are safe to use with the STL; what kinds aren't, and why? What techniques are available
for writing powerful generic template code that can change its own behavior based on the capabilities
of the types it's given to work with? How can you switch easily between different kinds of input and
output streams? How does template specialization and overloading work? And what's with this funny
typename keyword, anyway?
This and more, as we delve into topics related to generic programming and the C++ standard library.