Skip to Content
Effective C++, Third Edition
book

Effective C++, Third Edition

by Scott Meyers
May 2005
Intermediate to advanced
320 pages
10h 24m
English
Addison-Wesley Professional
Content preview from Effective C++, Third Edition

7. Templates and Generic Programming

The initial motivation for C++ templates was straightforward: to make it possible to create type-safe containers like vector, list, and map. The more people worked with templates, however, the wider the variety of things they found they could do with them. Containers were good, but generic programming — the ability to write code that is independent of the types of objects being manipulated — was even better. STL algorithms like for_each, find, and merge are examples of such programming. Ultimately, it was discovered that the C++ template mechanism is itself Turing-complete: it can be used to compute any computable value. That led to template metaprogramming: the creation of programs that execute inside C++ ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

The C++ Programming Language, 4th Edition

The C++ Programming Language, 4th Edition

Bjarne Stroustrup

Publisher Resources

ISBN: 0321334876Purchase book