原始字符串文字是否像普通字符串文字一样以 null 结尾?

问题描述 投票:0回答:1

我知道字符串文字总是以 null 结尾,即使

""
的长度为 1。

与原始字符串文字的情况相同吗,例如:

R"()"
的长度是否为1?

c++ string c++11 string-literals rawstring
1个回答
5
投票

原始字符串文字只是忽略转义的普通 C 字符串,这意味着它们仍然以 null 结尾。它不像

"foo"s
,它是一个实际的 c++
std::string
,它不一定以 null 终止。

© www.soinside.com 2019 - 2024. All rights reserved.