i have stringstream object , wondering how initialize it.
stringstream os; for(int = 0; < 10; ++i){ value = rand() % 100; os<<value; cout<<os.str()<<" "<<os<<endl; ntree->insert(os.str()); //i want os object initialized here }
if want new ostringstream object each time through loop, obvious solution declare new 1 @ top of loop. of ostream types contain lot of state, , depending on context, may more or less difficult reset of state.
Comments
Post a Comment