[英]C++: multiline string literal with concatenation?
如何定义可以与其他变量串联的多行原始字符串文字? 以下内容无法编译:
#define theValue 1000
static std::string str = R"(
foo )" + theValue + R"( bar
)";
#define theValue 1000
static std::string str = R"(
foo )" + std::to_string(theValue) + R"( bar
)";
在一般情况下,你需要string
可以隐式转换为S或东西string
才能使用std::string
的连接符。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.