虽然左移运算符 (<<) 在 std::cout 之前使用,但它有什么用?
While left shift operator (<<) using before std::cout , what does it work for?
那些代码行:
std::cout << "observerIndex : " <<
std::cout << pobserverIndex -> observerInt() ;
生成编译器错误以下:
file.C:2917:37: error: no match for 'operator<<' (operand types are 'std::basic_ostream<char>' and 'std::basic_ostream<char>')
std::cout << "observerIndex : " <<
^
任何人都可以告诉我剩下的移动操作员(<<
)在那里做什么(std::cout << pobserverIndex -> observerInt()
之前)?
您似乎在第一个语句结束时似乎缺少半隆,而且您正在重复std::cout
。
您需要使用
std::cout << "observerIndex: " << pobserverIndex -> observerInt();
之类的变体 std::cout << "a" << std::cout<< "b";
在std
名称空间中输出对象cout
的地址,格式为十六进制,在字符串" A"answers" B"之间。
相关文章:
- 为不同配置设置MSVC_RUNTIME_LIBRARY的正确方法是什么
- 警告处理为错误这里有什么问题
- 什么时候调用组成单元对象的析构函数
- #定义c-预处理器常量..我做错了什么
- 努力将整数转换为链表。不知道我在这里做错了什么
- C++我的数学有什么问题,为什么我的代码不能正确循环
- 什么时候在C++中返回常量引用是个好主意
- 当在同一名称空间中有两个具有相同签名的函数时,会发生什么
- C++避免重复声明的语法是什么
- c++库的公共头文件中应该包含什么
- 问题:什么是QAbstractItemView::NoEditTriggers的反面
- 有什么方法可以遍历结构吗
- 当类在C++中定义时,有什么方法可以"register"类吗?
- ifstream什么都没读
- 在C++中,将大的无符号浮点数四舍五入为整数的最佳方法是什么
- 实现无开销push_back的最佳方法是什么
- 什么是模板&lt;&gt;inline bla bla
- &lt;&lt;&lt;的这些超载有什么区别操作员
- 这是做什么的?如果(无符号(dx) & lt;无符号(大小))
- 什么会导致死亡<<变量& lt; & lt;“ t";当输出超过终端宽度时,打印空白而不是值