samedi 28 novembre 2015

Passing string to istringsream argument of a function

I would like to work with istringstream within a function and I want the istringstream to be initialized by a string passed by value. Can I avoid the explicit istringstream iss_input(string_input); in the function body?

void f(istringstream command){
}

int main(){
    f( string("create_customer 1 Ben Finegold") );
}

The above demonstrates what I want to achieve, but it does not work. The problem I am solving is command parsing.

Aucun commentaire:

Enregistrer un commentaire