[英]How to print contents of a container using std::format
使用fmtlib ,我們可以按如下方式打印容器:
#include <vector>
#include <fmt/ranges.h>
int main() {
std::vector<int> v = {1, 2, 3};
fmt::print("{}\n", v);
}
我可以在 c++20 標准庫版本中做同樣的事情嗎?
格式化范圍不是 C++20 std::format
的一部分,但P2286為 C++23 提出了它。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.