...

/

std::any

std::any

C++17 allows us to put our value in a safe container which can be accessed only when its type is specified. Welcome to std::any.

The new C++17 data types std::any, std::optional, and std::variant are all based on the Boost libraries.

std::any is a type-safe container for single values of any type which is copy-constructible. There are a few ways to create a std::any ...