gpt4 book ai didi

c++ - 为什么boost::format不能直接转换为std::string?

转载 作者:可可西里 更新时间:2023-11-01 16:28:14 26 4
gpt4 key购买 nike

<分区>

以下是不可能的:

std::string s = boost::format("%d") % 1; // error

你必须明确地调用方法 str():

std::string s = (boost::format("%d") % 1).str(); // OK

这只是语法糖,但为什么不直接添加转换呢?

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com