Is there a way to get the int value by performing division on boost::any variables?
#include <boost/any.hpp>
int main(void) {
boost::any a = 10;
std::cout << boost::any_cast<int>(a) << std::endl;
boost::any s = 2.5; // scaling factor
// scale the value
a = boost::any_cast<int>(a)/boost::any_cast<float>(s);
std::cout << boost::any_cast<int>(a) << std::endl;
}
This throws the error
boost::bad_any_cast: failed conversion using boost::any_cast
Thanks