Converting strings to other types

I am reading command line arguments passed through a c++ program.

I am using the following

 
string  arg_genr;
int ngenr;
istringstream iss_ngenr(arg_genr);
iss_genr >> ngenr;
 
string  arg_tstep;
float tstep;
istringstream iss_tstep(arg_tstep);
iss_tstep >> tstep;

I wonder what people think of this method of converting strings to other types. Is this a good way to do it?

It works. It's inefficient, and difficult to do anything fancy with it, but it's also difficult to get it wrong unlike some faster methods.

What do you suggest instead?

Are stoi, stof, and stod slow as well?

---------- Post updated at 12:46 PM ---------- Previous update was at 12:10 PM ----------

I am aware Boost lexical cast is slow as well

stoi, stof, etc are likely as fast as you can get. Error detection will be more difficult however, they do not throw anything.

Also, ask yourself whether performance is important. Are you processing thousands of numbers, or just two?

Seems that using boost spirit might give better performance. Have you ever tried using spirit?
Will be passing a few tens of numbers.

Boost is enormous. It's difficult to believe Boost could improve the performance of anything -- mostly it's a programmer convenience.

For tens of numbers, who cares? You have a method that works.