Skip to content

Instantly share code, notes, and snippets.

@deque-blog deque-blog/repeat_n.cpp
Last active May 10, 2017

Embed
What would you like to do?
std::string repeat_n(int n, std::string const& s)
{
std::string out;
out.reserve(s.size() * n);
for (int i = 0; i < n; ++i)
out.append(s);
return out;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.