Skip to content

Instantly share code, notes, and snippets.

@mingl0280
Last active November 6, 2016 20:59
Show Gist options
  • Save mingl0280/b3886d42cbf2c74b9acf385b1e2f976a to your computer and use it in GitHub Desktop.
Save mingl0280/b3886d42cbf2c74b9acf385b1e2f976a to your computer and use it in GitHub Desktop.
#include <string>
#include <sstream>
#include <iterator>
#include <iostream>
using namespace std;
string operator*(string &a, int b)
{
if (b<=0) return "";
if (b==1) return a;
stringstream ss;
fill_n(ostream_iterator<const char*>(ss), b, a.c_str());
return ss.str();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment