P
pedagani
Dear comp.lang.c++,
Could you make this snippet more efficient? As you see I have too many
variables introduced in the code.
//Read set of integers from a file on line by line basis in a STL set
//fp is pre-defined
for(;!fp.eof()
{
string linestr;
getline(fp,linestr);
istringstream strstreamline(linestr);
istream_iterator<unsigned int> intstream(strstreamline);
set<unsigned int> pckset;
copy ( intstream , istream_iterator<unsigned int>() ,
inserter(modpckset,modpckset.begin ( ) ));
}
Thanks in advance.
Could you make this snippet more efficient? As you see I have too many
variables introduced in the code.
//Read set of integers from a file on line by line basis in a STL set
//fp is pre-defined
for(;!fp.eof()
{
string linestr;
getline(fp,linestr);
istringstream strstreamline(linestr);
istream_iterator<unsigned int> intstream(strstreamline);
set<unsigned int> pckset;
copy ( intstream , istream_iterator<unsigned int>() ,
inserter(modpckset,modpckset.begin ( ) ));
}
Thanks in advance.