July 2015
Intermediate to advanced
558 pages
13h 31m
English
C++11 introduced the ability to capture and store an exception that can be passed around and rethrown later. This is particularly useful for propagating exceptions across threads.
To store an exception, the type std::exception_ptr is used. std::exception_ptr is a smart pointer type with shared ownership semantics, not unlike std::shared_ptr (see Chapter 3, Memory Management and Exception Safety). An instance of std::exception_ptr is copyable and movable and can be passed to other functions potentially across threads. A default-constructed std::exception_ptr is a null object that does not point to any exception. Copying a std::exception_ptr object creates two instances that manage ...
Read now
Unlock full access