int main()
{
std::map<std::string, std::string> o;
o["foo"] = "foo value";
spdlog::info(o);
return 0;
}Got错误: static_assert由于需求' formattable‘而失败“不能格式化参数。
发布于 2020-05-07 20:35:39
spdlog只支持具有operator <<的类型(使用#include <fmt/ostream.h>)
你有两个选择:
实现函数:std::ostream& operator <<(std::ostream&, const std::map<std::string, std::string>&)
for (const auto&[k, v] : o)
{
spdlog::info("key is {}, value is {}", k, v);
}https://stackoverflow.com/questions/61436835
复制相似问题