[英]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.