久久久久久久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 仍然相關嗎?)
主站蜘蛛池模板: 精品久久国产 | 久久精品性视频 | 国产精品美女久久久久久免费 | www.日韩在线 | 91视频网| 久久精品成人热国产成 | 日日干夜夜操 | 久久99久久久久 | 欧美一区二区免费电影 | 国产高清视频一区 | 全免一级毛片 | 久久精品16| 精品国产欧美一区二区三区成人 | 久久精品色视频 | 中文字幕av一区二区三区 | 日韩一区二区三区视频 | 欧美三级电影在线播放 | 久久免费资源 | 色欧美日韩 | 黄色一级大片在线免费看产 | 亚洲一区二区三区在线播放 | 高清视频一区二区三区 | 欧美一卡二卡在线观看 | 亚洲精品日韩一区二区电影 | 国产精品久久久久久一区二区三区 | 国产一区999| 人人澡人人爱 | 久草热播| 日本特黄特色aaa大片免费 | 黑人巨大精品欧美一区二区免费 | 国产成人99久久亚洲综合精品 | 亚洲精品久久久一区二区三区 | 日韩高清中文字幕 | 久久亚洲一区二区三区四区 | 欧美乱人伦视频 | 国产成人99久久亚洲综合精品 | 在线免费国产视频 | 天天操操 | 操人网站 | 欧美综合国产精品久久丁香 | 午夜成人免费视频 |