I don't what to copy string to trim it later. I parse csv file, my code:
while(std::getline(stream, line))
{
boost::tokenizer<boost::escaped_list_separator<char>> tok(line);
std::for_each(tok.begin(), tok.end(), handler);
}
parseCSV(file, [](const std::string& tok)
{
std::vector<SpiceSimulation::DataVector*> arrays;
std::this_thread::sleep_for(std::chrono::milliseconds(500));
std::cout << "\t-->" << tok << std::endl;
//std::string cptoken = boost::trim_copy(tok);
//Read Header Titles
if(boost::starts_with(tok, "v"))
{
std::cout << "START WITH\n";
}
});
My file.csv:
time, vtime2, vtime3, vtime4 ...
I get results with whitespaces Result: ["time"," vtime2"," vtime3"," vtime4"]
How can I rid of these whitespaces without copying? If I understand right tokenizer return result as basic_string it isn't a copy of original string