Mar. 2nd, 2015

chris_archer: (Default)

include

std::string operator*(std::string& s, unsigned int n)
{
std::string cml;

cml.reserve(s.size() * n);

for (decltype(n) i = 0; i < n; i++) { cml += s; } return cml; } int main() { std::string s = "test"; std::string sss = s*3; std::cout << sss << std::endl; }

Originally published at Chase Your Dreams!. You can comment here or there.

Profile

chris_archer: (Default)
chris_archer

June 2017

S M T W T F S
    123
456 78910
11121314151617
18192021222324
252627 282930 

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Aug. 21st, 2017 06:39 am
Powered by Dreamwidth Studios