| 1285 | } |
| 1286 | |
| 1287 | String operator*(const StringView string, const std::size_t count) { |
| 1288 | // Not using the size() accessor to speed up debug builds |
| 1289 | const std::size_t size = string._sizePlusFlags & ~Implementation::StringViewSizeMask; |
| 1290 | |
| 1291 | String result{NoInit, size * count}; |
| 1292 | |
| 1293 | // Apparently memcpy() can't be called with null pointers, even if size is zero. I call that bullying. |
| 1294 | char* out = result.data(); |
| 1295 | if (size != 0) for (std::size_t i = 0; i != count; ++i) |
| 1296 | std::memcpy(out + i * size, string._data, size); |
| 1297 | |
| 1298 | return result; |
| 1299 | } |
| 1300 | |
| 1301 | String operator*(const std::size_t count, const StringView string) { |
| 1302 | return string * count; |
no test coverage detected