The Basics
The basics talk about the former kind of exceptions thrown, and when to use std::any.
We'll cover the following
​In C++14
there weren’t many options for holding variable types in a variable. You could use void*
,
of course, but this wasn’t safe. void*
is just a raw pointer, and you have to manage the whole object
lifetime and protect it from casting to a different type.
Potentially, void*
could be wrapped in a class with some type discriminator.
Get hands-on with 1400+ tech skills courses.