Добавление форматированного контента к `std :: string` без создания временныхC++

Программы на C++. Форум разработчиков
Anonymous
Добавление форматированного контента к `std :: string` без создания временных

Сообщение Anonymous »

Я хочу создать следующую строку: "name_1, name_2, ..., name_100" < /code>.

Это можно выполнить с помощью следующего кода: < /p>

Код: Выделить всё

#include 
#include 

// ...

const auto first_index = 1;
const auto last_index = 100;
std::string result;

for (auto index = first_index; index 

Подробнее здесь: [url]https://stackoverflow.com/questions/79768016/appending-formatted-content-to-a-stdstring-without-creating-temporaries[/url]

Вернуться в «C++»