I'm designing a class where there's a method that should return a different data type depending on certain circunstances.

Specifically, I'm reading from a text file. If the data found are strings of characters, I'd like to return a vector of strings. On the other hand, I'd like to return a vector of floats if the data are numbers.

template <typename T>

vector<T> funcion(string typeConversion){

if (typeConversion== 'String')
//...
return list<string>
else if (typeConversion == 'Number')
//...
return vector<float>

}

I don't think this is possible with C++ (in Python, for instance, I think that methods can return every data type).

Do you know any alternative to solve my problem?

Thanks!