Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/162.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ <&书信电报;运算符与重载+;C+中字符串的运算符+;_C++_Performance_Operators - Fatal编程技术网

C++ <&书信电报;运算符与重载+;C+中字符串的运算符+;

C++ <&书信电报;运算符与重载+;C+中字符串的运算符+;,c++,performance,operators,C++,Performance,Operators,以下两行代码之间有区别吗 (也许是在效率或类似的性质上?) const std::string a=“a”; 常量std::字符串b=“b”; 标准::cout是: 第一行调用它依赖于编译器的operator'd gues,但第一行只相当于output a;输出字符串;产出b;输出字符串第二个是创建字符串a,连接字符串,连接变量b,连接字符串,输出完成的字符串是。这是有区别的。 const std::string a = "a"; const std::string b = "b"; std:

以下两行代码之间有区别吗

(也许是在效率或类似的性质上?)

const std::string a=“a”;
常量std::字符串b=“b”;
标准::cout是:


第一行调用它依赖于编译器的
operator'd gues,但第一行只相当于
output a;输出字符串;产出b;输出字符串
第二个是
创建字符串a,连接字符串,连接变量b,连接字符串,输出完成的字符串
是。这是有区别的。
const std::string a = "a";
const std::string b = "b";

std::cout << a << " comes before " << b << "\n";
std::cout << a + " comes before " + b + "\n";