Skip to content

Instantly share code, notes, and snippets.

@fabiogaluppo
Created January 1, 2016 14:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fabiogaluppo/e5e9355b40fd0e6e561f to your computer and use it in GitHub Desktop.
Save fabiogaluppo/e5e9355b40fd0e6e561f to your computer and use it in GitHub Desktop.
void unique(std::vector<std::string>&& ss)
{
ss.resize(std::distance(ss.begin(),
std::unique(ss.begin(), ss.end())));
for (auto& s : ss) std::cout << s << "\n";
}
std::vector<std::string> read_all_lines(std::istream& istr)
{
std::vector<std::string> temp;
std::string buffer;
while (std::getline(istr, buffer, '\n'))
{
temp.emplace_back(std::move(buffer));
}
return std::move(temp);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment