I am using two different variants where one can hold more types than the other.
typedef std::variant<boost::blank, double> EmptyDouble;
typedef std::variant<boost::blank, double, int> EmptyDoubleOrInt;
Now i want to use a function having the EmptyDoubleOrInt as parameter. This function works fine for an integer, double or blank, but not for a EmptyDouble type:
SomeFunction(EmptyDoubleOrInt input);
How can i convert the EmptyDouble to either a blank or double without having to know what type it has. So it will be a correct input for the function?
SomeFunction(DoSomething(emptyDouble))
You can use
std::visitto constructEmptyDoubleOrIntfromemptyDouble: