有人可以向我解释为什么这个程序会向 std::cout 发送地址吗?
#include<string>
#include<iostream>
#include<fstream>
std::ostream& stuff(std::ostream& o, std::string s)
{
o << s << std::endl;
return o;
}
int main(){
std::cout << stuff(std::cout, "word") << std::endl;
}
它是由 main() 中的 std::endl 引起的。但是为什么呢?
输出:
word
0x804a064