我是c++的新手。我用windows10中的visual-studio-code编译了我的代码,并使用了string和string_view类型的两个变量.string变量很好,但是string_view给出了错误,我还在configuration.json中启用了c++17扩展,并在vscode中编辑了配置/ui文件。这是我的code:=#include<string_view>
using n
我正在使用c++/17 std::string_view传递通过锁定操作从系统获得的原始内存缓冲区(IMFMediaBuffer.Lock(..)在Windows Media foundation中),并将该视图的内容传递给一个函数,该函数接受std::istream&作为输入-为此,我目前正在构造一个新的std::istringstream,它使用视图内容进行初始化,如下所示:
std::string_viewst
有几种方法可以将文本信息传递到C++中的函数:它可以是c-string/std::string,by value/by reference,lvalue/rvalue,const/mutable。C++17在标准库中添加了一个新类:std::string_view。string_view的语义是提供没有所有权的只读文本信息。::string&); // if you read the string wi