久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

cout<<調用它打印的函數的順序?

cout lt;lt; order of call to functions it prints?(coutlt;lt;調用它打印的函數的順序?)
本文介紹了cout<<調用它打印的函數的順序?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

以下代碼:

myQueue.enqueue('a');
myQueue.enqueue('b');
cout << myQueue.dequeue() << myQueue.dequeue();

在控制臺打印ba"

同時:

myQueue.enqueue('a');
myQueue.enqueue('b');
cout << myQueue.dequeue();
cout << myQueue.dequeue();

打印ab"這是為什么?

prints "ab" why is this?

似乎 cout 首先調用最外層(最接近 ;)的函數并按其方式工作,這是它的行為方式嗎?

It seems as though cout is calling the outermost (closest to the ;) function first and working its way in, is that the way it behaves?

推薦答案

<< 運算符沒有序列點,因此編譯器可以自由地評估 dequeue> 功能第一.保證的是第二個 dequeue 調用的結果(按照它在表達式中出現的順序,不一定是它的計算順序)是 <<<< 的第一個結果(如果你明白我在說什么).

There's no sequence point with the << operator so the compiler is free to evaluate either dequeue function first. What is guaranteed is that the result of the second dequeue call (in the order in which it appears in the expression and not necessarily the order in which it is evaluated) is <<'ed to the result of <<'ing the first (if you get what I'm saying).

因此編譯器可以自由地將您的代碼翻譯成任何類似的東西(偽中間 C++).這并不是一份詳盡的清單.

So the compiler is free to translate your code into some thing like any of these (pseudo intermediate c++). This isn't intended to be an exhaustive list.

auto tmp2 = myQueue.dequeue();
auto tmp1 = myQueue.dequeue();
std::ostream& tmp3 = cout << tmp1;
tmp3 << tmp2;

auto tmp1 = myQueue.dequeue();
auto tmp2 = myQueue.dequeue();
std::ostream& tmp3 = cout << tmp1;
tmp3 << tmp2;

auto tmp1 = myQueue.dequeue();
std::ostream& tmp3 = cout << tmp1;
auto tmp2 = myQueue.dequeue();
tmp3 << tmp2;

這是原始表達式中臨時詞對應的內容.

Here's what the temporaries correspond to in the original expression.

cout << myQueue.dequeue() << myQueue.dequeue();
|       |               |    |               |
|       |____ tmp1 _____|    |_____ tmp2 ____|
|                       |
|________ tmp3 _________|

這篇關于cout&lt;&lt;調用它打印的函數的順序?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

Algorithm to convert RGB to HSV and HSV to RGB in range 0-255 for both(將 RGB 轉換為 HSV 并將 HSV 轉換為 RGB 的算法,范圍為 0-255)
How to convert an enum type variable to a string?(如何將枚舉類型變量轉換為字符串?)
When to use inline function and when not to use it?(什么時候使用內聯函數,什么時候不使用?)
Examples of good gotos in C or C++(C 或 C++ 中好的 goto 示例)
Significance of ios_base::sync_with_stdio(false); cin.tie(NULL);(ios_base::sync_with_stdio(false) 的意義;cin.tie(NULL);)
Is TCHAR still relevant?(TCHAR 仍然相關嗎?)
主站蜘蛛池模板: 成人免费视频播放 | 免费视频二区 | 综合久久综合久久 | 天久久| 在线免费观看黄色 | 日韩视频免费看 | 激情欧美一区二区三区 | 国产激情91久久精品导航 | 亚洲一区二区三区四区视频 | www国产亚洲精品久久网站 | 一区二区三区国产精品 | www.色午夜.com| 久久九九免费 | 伊人欧美视频 | 国产高清视频一区 | 在线视频日韩精品 | 久久久久亚洲精品国产 | 久久亚洲综合 | 精品视频一区二区 | 久久精品国产免费一区二区三区 | 不卡一区二区三区四区 | 精品欧美一区二区三区久久久小说 | 中文字幕av第一页 | 一本大道久久a久久精二百 欧洲一区二区三区 | 国产一级淫片免费视频 | 国产精久久久久久久 | 欧美激情a∨在线视频播放 成人免费共享视频 | 成人免费视频 | 欧美国产日韩在线观看 | 日本不卡一区 | 国产区视频在线观看 | 欧美日韩在线观看一区 | 国产亚洲网站 | 97视频在线观看网站 | 大久| 亚洲精品在线播放 | 亚洲精品久久久久久一区二区 | 九九热国产视频 | 国产精品久久久久久久久大全 | a在线观看| 久久久久国 |