In the particular case of repeating a single character, you can use std::string(size_type count, CharT ch)
:
std::string(5, '.') + "lolcat"
This can’t be used to repeat multi-character strings.
More Related Contents:
- How to add all positive integers and get their average [closed]
- character and array [closed]
- Error when reading txt file, can’t read txt file correctly
- What is an ‘undeclared identifier’ error and how do I fix it?
- How to properly overload the
- Comparing a variable to a range of values
- Can the arguments of main’s signature in C++ have the unsigned and const qualifiers? [duplicate]
- GCC issue: using a member of a base class that depends on a template argument
- std::queue iteration
- Most accurate way to do a combined multiply-and-divide operation in 64-bit?
- Using SDL2 with CMake
- constant references with typedef and templates in c++
- Is it possible to “store” a template parameter pack without expanding it?
- Search a vector of objects by object attribute
- Friend scope in C++
- Accessing private members [closed]
- Case insensitive string comparison C++ [duplicate]
- CMake is not finding Boost
- treating memory returned by operator new(sizeof(T) * N) as an array
- Searching in a sorted and rotated array
- DLL References in Visual C++
- Thread safe lazy construction of a singleton in C++
- Overloading assignment operator in C++
- Image scaling (KeepAspectRatioByExpanding) through OpenGL
- What is the meaning of auto when using C++ trailing return type?
- How do I clear the console in BOTH Windows and Linux using C++
- How to ensure that the template parameter is a subtype of a desired type?
- C++ Access derived class member from base class pointer
- Performance difference of “if if” vs “if else if”
- Lifetime of object is over before destructor is called?