Skip to Content
Programming: Principles and Practice Using C++, 3rd Edition
book

Programming: Principles and Practice Using C++, 3rd Edition

by Bjarne Stroustrup
April 2024
Beginner
656 pages
23h 19m
English
Addison-Wesley Professional
Content preview from Programming: Principles and Practice Using C++, 3rd Edition

18

Templates and Exceptions

Success is never final.

– Winston Churchill

This chapter completes the design and implementation of the most common and most useful STL container: vector. We show how to specify containers where the element type is a parameter and how to deal with range errors. As usual, the techniques used are generally applicable, rather than simply restricted to the implementation of vector, or even to the implementation of containers. The techniques rely on templates and exceptions, so we show how to define templates and give the basic techniques for resource management that are the keys to good use of exceptions. In this context, we discuss the general resource-management technique called “Resource Acquisition is Initialization” ...

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

Programming: Principles and Practice Using C++, 2nd Edition

Programming: Principles and Practice Using C++, 2nd Edition

Bjarne Stroustrup

Publisher Resources

ISBN: 9780138308667