Ras*_*sto 0 c++ string stdout bit-shift
我想做一些非常简单的事情:我的函数有字符串参数,我想将它链接到一些常量字符串,然后将结果输出到控制台,如下所示:
void test(string s){
cout << "Parameter of this function was: " << s;
}
Run Code Online (Sandbox Code Playgroud)
在其他语言中,这样的链接有效,但在C++中,编译器不满意: error C2679: binary '<<': no operator found which takes a right-hand operand of type 'std::string' (or there is no acceptable conversion)