Witam,
realizuję projekt, a głównie używaną w nim funkcją jest explode phpowe. Porównywałem mój kod z innymi z internetu i wychodzi, że jest najszybszy. Macie pomysł jak go jeszcze przyspieszyć?
std::vector<std::string> BaseTools::explode(const std::string & text, char separate){
std::vector<std::string> results;
results.push_back("");
short word = 0;
for (int i = 0; i < text.length(); ++i){
if (text.at(i) != separate){
results.at(word) += text.at(i);
}
else{
if (i != text.length()-1)
if (text.at(i+1) != separate){
word++; results.push_back("");
}
}
}
return results;
}
//Funkcja ma być "odporna" na argumentów typu "aaa.bbb.cc.....dddd.eee...vcf..", "."