当我进行下面的练习时,删除我的指针成员并为其分配新值。
(*pMyPointer).member.erase();
(*pMyPointer).member.assign("Hello"); // Successfully
比我尝试的更多...
(*pMyPointer).member.erase();
(*pMyPointer).member.assign("Long Multi Lines Format String"); // How to?
如果长多行字符串无法用双引号引用,如何处理。谢谢。
最佳答案
我真的不知道你想问什么。也许是这样的:
(*pMyPointer).member.assign("Long Multi Lines Format String"
"more lines that will be"
"concatenated by the compiler");
或者你的意思是这样的换行符:
(*pMyPointer).member.assign("Long Multi Lines Format String\n"
"more lines that will be\n"
"concatenated by the compiler");
关于c++ - 如何为长字符串分配指针成员?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2855214/