Everything You Need to Know About std::any From C++17, Part 1

With std::optional you can represent some type or nothing. With std::variant you can wrap several variants into one entity. And C++17 gives us one more wrapper type, std::any, that can hold anything in a type-safe way.
The Basics
So far in Standard C++, you have not had many options when it comes to holding variable types in a variable. Of course, you could’ve used void*, yet this wasn’t super safe.

Link: https://dzone.com/articles/everything-you-need-to-know-about-stdany-from-c17?utm_medium=feed&utm_source=feedpress.me&utm_campaign=Feed%3A+dzone%2Fwebdev