Is there a unique way to achieve a uniform call syntax for a convert function like the following for any kind of type? The function takes a string and converts it into the given TYPE (here int
and MyMatrix<double>::Vector3
, call by reference of course!!)
int a;
std::string b = "asd";
stringToType::call(a,b);
MyMatrix<double>::Vector3 g; // Vector3 might be any type e.g Eigen::Matrix<double,3,1>
stringToType::call(g,b);
e.g:
template<typename T>
struct MyMatrix{
typedef Eigen::Matrix<T,3,1> Vector3;
};
I would like that the convert function converts types in the form of Eigen::Matrix<T,3,1>
with T
arbitary with the same function,
It should also support the basic types which have no template parameters (like the int
)