-
-
Save cdglove/a1411fc9c6adc21c7f9c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void split_csv(std::string raw_csv, std::set<std::string>& dest_set) | |
{ | |
std::vector<boost::iterator_range<std::string::iterator>> result; | |
boost::algorithm::split(result, raw_csv, [](char c) | |
{ | |
return c == ','; | |
}); | |
boost::transform(result, std::inserter(dest_set, dest_set.begin()), | |
[](boost::iterator_range<std::string::iterator> r) | |
{ | |
auto begin = r.begin(); | |
auto end = r.end(); | |
while(begin != end && std::isspace(*begin)) | |
++begin; | |
while(begin != end && std::isspace(*(end - 1))) | |
--end; | |
return std::string(begin, end); | |
} | |
); | |
dest_set.erase(""); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment