Using {fmt}, we can print a container as follows:
#include <vector>
#include <fmt/ranges.h>
int main() {
std::vector<int> v = {1, 2, 3};
fmt::print("{}\n", v);
}
Can I do the same in the C++20 standard library version?
Formatting ranges is not a part of C++20 std::format
but is supported in C++23:
import std;
int main() {
std::vector<int> v = {1, 2, 3};
std::print("{}\n", v);
}