how to pass argv[] to template class?

Hi everyone.
I have a problem with passing program argument to template class.

program usage:
progname inputFile dataType (for example progname in1.txt double)

so argv[2] is some class name or data type (for example int, double or MyClass)

I have template class:

template <class DT>
class Pair{
public:
Pair(ifstream &in_file){in_file >> _key >> _data;}
.
.
private:
DT _data;
int _key;
};

in main I have:

int main(int argc, char *argv[])
{
.
.
.
ifstream in_file;
in_file.open(argv[1]);

char* dataType = argv[2];

Pair<dataType> pair(in_file);

and here I have error message: "'dataType' is not a valid template type argument for parameter 'DT'"
How can I solve it? i must somehow convert char* dataType(for example double) to legal class name.



Don't post the same question in two forums!
sorry. can I somehow remove post from here?
I don't think so. You can always edit it, and replace the text with REMOVED.
Topic archived. No new replies allowed.