4 ms·
Why using boost is overkill? You use std::XXX and the STL, do you consider these too? For the two cases you mentioned, boost comes with nice functions to solve
by slug 16y ago
Why using boost is overkill? You use std::XXX and the STL, do you consider these too? For the two cases you mentioned, boost comes with nice functions to solve them (lexical_cast, which uses stringstream and the boost tokenizer).
tokenizer<> tok(s);
for(tokenizer<>::iterator beg=tok.begin();beg!=tok.end();++beg){
cout << *beg << "\n";
}
It surely beats the C approach of handling pointers my hand, or the ugly interface of strtok / strtoX (X=l,d,etc). At least in C++ you can use the same function for any number type.
I see the need of C (or ASM), but with char/string manipulation it loses any battle with any other language, except probably speed.