Skip to Content
Exceptional C++: 47 Engineering Puzzles, Programming Problems, and Solutions
book

Exceptional C++: 47 Engineering Puzzles, Programming Problems, and Solutions

by Herb Sutter
November 1999
Intermediate to advanced
240 pages
5h 22m
English
Addison-Wesley Professional
Content preview from Exceptional C++: 47 Engineering Puzzles, Programming Problems, and Solutions

Chapter 8. Writing Exception-Safe Code—Part 1

Difficulty: 7

Exception handling and templates are two of C++'s most powerful features. Writing exception-safe code, however, can be difficult—especially in a template, when you may have no idea when (or what) a certain function might throw your way.

We'll begin where Cargill left off—namely, by progressively creating a safe version of the Stack template he critiqued. Later on, we'll significantly improve the Stack container by reducing the requirements on T, the contained type, and show advanced techniques for managing resources exception-safely. Along the way, we'll find the answers to such questions as:

  • What are the different “levels” of exception safety?

  • Can or should generic containers be fully exception-neutral? ...

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

Exceptional C++ Style 40 New Engineering Puzzles, Programming Problems, and Solutions

Exceptional C++ Style 40 New Engineering Puzzles, Programming Problems, and Solutions

Herb Sutter

Publisher Resources

ISBN: 0201615622Purchase book