I'd need to modify a simple struct to accept multiple types of value parameters, as shown below:
struct menuitems_t
{
menuitems_t(std::string name, float* value = 0, int itemtype = menuitemtype::SWITCH)
{
this->name = name;
this->value = value;
this->itemtype = itemtype;
}
std::string name;
float* value;
int itemtype;
};
I tried to create a template from it, but with no luck.
declaring one of these is like menuitems_t(nameString, val1, type);
My only problem is that if I want to use a bool as the referenced value it won't accept it obviously. (I can cast it as a float, but that's not what I want.)
What should I modify in it to accept any types?