I have some code like this:
const std::string first = "|>first {} thing<|";
const std::string second = "|>second thing<|";
const std::string third = "|>third thing<|";
const std::string fourth = "|>fourth thing<|";
const std::string out = std::format("Testing {} format {} string {}", first, second, third, fourth);
std::cout << out << std::endl;
This code outputs the following:
Testing |>first {} thing<| format |>second thing<| string |>third thing<|
. I would like the code to output: Testing |>first |>second thing<| thing<| format |>third thing<| string |>fourth thing<|
.
The difference is the |>first {} thing<|
has been replaced by |>first |>second thing<| thing<|
. That is, the format is applied recursively. std::format
has a lot of compile time checks, but in theory nothing is stopping std::vformat
from being able to do so.
Before I implement this functionality on my own, I would like to know whether it exists in the standard library, or if another robust solution is already available.