Dear C++ Committee,
I hope this message finds you well. I am writing to propose an enhancement to the template class std::any in the C++ standard library. The proposed enhancement aims to simplify the usage of std::any by adding a conversion function, thereby eliminating the need for explicit std::any_cast operations.
Currently, using std::any requires explicit casting using std::any_cast
but adding a conversion function to std::any will allow users to convert the stored value to a specified type directly, without the need for std::any_cast
which will
std::any.std::any is used as an argument to an overloaded function. With the proposed conversion function, we can use the builtin static_cast which is more convenient to be used than the template function std::any_cast.