C++ Language/Type/Variant/AnyVariant

A variable xVar whose type is std::any can store values of differing types at different points in time. After assigning xVar = 1.1F;, that float value can be accessed by std::any_cast<float>(xVar);. An uninitialized any-variable will be in a special "no value" state that will be reported by xVar.has_value().

Additional information about any-variant (includes interactive examples)