c++ - FastFormat 有 'catch' 吗?

标签 c++ fastformat

我刚刚读到 FastFormat C++ i/o formatting library ,而且看起来好得令人难以置信:甚至比 printf 更快,类型安全,并且具有我认为令人愉悦的界面:

// prints: "This formats the remaining arguments based on their order - in this case we put 1 before zero, followed by 1 again"
fastformat::fmt(std::cout, "This formats the remaining arguments based on their order - in this case we put {1} before {0}, followed by {1} again", "zero", 1);

// prints: "This writes each argument in the order, so first zero followed by 1"
fastformat::write(std::cout, "This writes each argument in the order, so first ", "zero", " followed by ", 1);

这看起来好得令人难以置信。有问题吗?你有过好的、坏的或无所谓的经历吗?

最佳答案

Is there a 'catch' with FastFormat?

上次我检查时,有一个烦人的问题:

你只能使用 either 这个库的窄字符串版本 这个库的宽字符串版本。 (wchar_tchar 的功能是一样的——使用哪种类型是编译时的开关。)

对于 iostreams、stdio 或 Boost.Format,您可以同时使用这两种方法。

关于c++ - FastFormat 有 'catch' 吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/446276/

相关文章:

c++ - 使用符号位翻转和加法进行浮点减法

c++ - 为什么 GCC -O3 在 std::deque 上使用过滤器迭代器导致无限的 std::distance?

c++ - Windows FormatMessage 的安全/灵活外观

c++ - 如何保证接受无限数量参数的函数的类型安全?

c++ - C++ 格式化库通常会回退到 *sprintf 进行数字格式化吗?

c++ - 如何将 C++ 字符串转换为 int?

c++ - Windows C++ 间歇性套接字断开连接

c++ - 如何在 QPushButton 悬停时设置高亮

c++ - OS X 上的快速格式化