Skip to content

Instantly share code, notes, and snippets.

@deque-blog
Last active May 10, 2017 16:13
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 deque-blog/e1c09e48ee9c429d05da8fba52dfc1d4 to your computer and use it in GitHub Desktop.
Save deque-blog/e1c09e48ee9c429d05da8fba52dfc1d4 to your computer and use it in GitHub Desktop.
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