There's a value stored in std::any and I want to know if it's an integral value (char, short, int, long, both signed and unsigned) or a floating point value (float, double), or something else.
If I only had to check for int values, I would do this:
std::any a;
if (a.type() == typeid(int)) {
// do some logic for int
}
But to do a giant if (a.type() == typeid(int) || a.type() == typeid(signed char)...) for all the integral types in C++ seems... bad.
I could use is_arithmetic<T> from type_traits if I had the type T accessible somehow but I don't, I only have std::any#type() which returns std::type_info.
Is there a way to accomplish this without many, many disjunctions in the if condition?
(I'm using C++20 if it's important)