“cout” cout“ - 输出代表什么? [英] "cout << cout" - what does the output stand for?
本文介绍了“cout” cout“ - 输出代表什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
经过一天的编码后,我偶然写了
After a long day of coding i accidentaly wrote
cout << "some text" << cout;
而不是
cout << "some text" << endl;
现在打印出一个内存地址。它指向什么?
Now it printed out a memory address. What does it point to ?
推荐答案
std :: cout
是 std :: ostream
,在C ++ 11之前,有一个转换运算符到 void *
。看来你的代码触发了转换,给你 std :: cout
对象的地址。
std::cout
is an instance of std::ostream
, and, before C++11, that had a conversion operator to void*
. It seems your code is triggering that conversion, giving you the address of the std::cout
object.
这篇关于“cout” cout“ - 输出代表什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文