template <typename T>
class getFlagParamVisitor : public boost::static_visitor<T>
{
int index;
public:
explicit getFlagParamVisitor( constint& i ) : index( i ) {}
T operator()(Flag<int> & x) const
{
return 1.2;
}
T operator()(Flag<float> & x) const
{
return 1.2;
}
T operator()(Flag<double> & x) const
{
return x.getParam( index );
}
T operator()(Flag<string> & x) const
{
return 1.2;
}
};
template <typename T> T getFlagParam(var_t& x, constint i) { return apply_visitor( getFlagParamVisitor<T>(i), x ); }
If I call getFlagParam<float>(*it, 0)
it works fine, but I would like not to call getFlagParam as a template...
I would like that the output of my getFlagParamVisitor should be automatically recognized...is that possible?