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

對于嵌套模板,`>>` 何時成為標準 C+

For nested templates, when did `gt;gt;` become standard C++ (instead of `gt; gt;`)?(對于嵌套模板,`gt;gt;` 何時成為標準 C++(而不是`gt; gt;`)?)
本文介紹了對于嵌套模板,`>>` 何時成為標準 C++(而不是`> >`)?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

限時送ChatGPT賬號..

我似乎記得,在過去,在處理嵌套模板參數時被警告不要將兩個 > 字符放在彼此旁邊(沒有空格).我什至依稀記得聲明了向量的向量并遇到了這個編譯錯誤.

I seem to recall, in times of yore, being warned against putting two > characters right next to each other (without a space) when dealing with nested template parameters. I even vaguely remember declaring vectors of vectors of whatever and encountering this compilation error.

但現在我發現編譯可怕的>>...

But now I find that there is absolutely nothing wrong with compiling the dreaded >>...

我的問題是:

這個約定在什么時候成為可以接受的做法?

At what point did this convention become an acceptable practice?

它是標準 C++ 的一部分嗎?

Is it part of standard C++?

它是否一直是標準的一部分,而我在大學使用的編譯器(以及我的教授)還不支持它?

Was it always part of the standard and the compilers I used (and the professors I had) in college just didn't support it yet?

也許這些問題有點歷史,但對我來說,適當的歷史背景似乎使實際記憶變得微不足道.

Maybe these questions are a tad bit historical, but for me it seems that proper historical context makes actual remembering trivial.

推薦答案

使用嵌套 >>> 關閉的模板是 正式支持 即將推出的標準 C++0x(現在是 C++11).以前,您需要空間或編譯器為您加倍努力(并且做了標準未指明的事情).

Templates closed with nested >> are officially supported by the upcoming standard C++0x (now C++11). Previously you would need the space, or a compiler that went the extra mile for you (and did things not indicated by the standard).

問題源于C中的>>是右移運算符,它是一個單獨的詞法標記,與兩個單獨的>沖突code> 在經典構造的 C++ 編譯器的解析階段需要的標記(并且僅在模板的情況下,而不是在它實際上是右移時).換句話說,>>,如果允許關閉嵌套模板,在詞法上是模棱兩可的,但是這可以(并且正在)在解析過程中通過額外的復雜性來解決(這在現代 C++ 中實際上是沒什么新鮮的).

The issue stems from the fact that >> in C is the right-shift operator, which is a single lexical token, which conflicts with the two separate > tokens that would be needed during the parsing stage in a classically-constructed C++ compiler (and only in the case of templates, not when it actually is a right-shift). In other words, the >>, if allowed to close nested templates, is lexically ambiguous, but this can be (and is being) addressed by extra sophistication during parsing (which in modern C++ is really nothing new).

這篇關于對于嵌套模板,`>>` 何時成為標準 C++(而不是`> >`)?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

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

相關文檔推薦

Difference between std::reference_wrapper and simple pointer?(std::reference_wrapper 和簡單指針的區別?)
Difference between const. pointer and reference?(常量之間的區別.指針和引用?)
How to access the contents of a vector from a pointer to the vector in C++?(c++ - 如何從指向向量的指針訪問向量的內容?)
Meaning of *amp; and **amp; in C++(*amp; 的含義和**amp;在 C++ 中)
Why can#39;t I do polymorphism with normal variables?(為什么我不能對普通變量進行多態?)
Dereferencing deleted pointers always result in an Access Violation?(取消引用已刪除的指針總是會導致訪問沖突?)
主站蜘蛛池模板: 欧区一欧区二欧区三免费 | 久久精品二区 | www.国产精品 | 欧美a v在线 | 亚洲成人精品一区 | 黑人巨大精品欧美一区二区一视频 | 欧美精品片 | 国产一区二区三区在线视频 | 99久久视频 | 国产精品99久久久久久www | 一区二区在线 | 午夜码电影 | 艹逼网 | 国产一区二区在线看 | 亚洲精品一区在线观看 | 久久精品| 国产精品视频导航 | 亚洲久久| 欧美在线亚洲 | 黄色大片在线 | 欧美亚洲第一区 | 国产精品久久精品 | 在线视频 中文字幕 | 欧美韩一区二区 | av中文字幕在线观看 | 最新中文字幕在线 | 亚洲精品一区av在线播放 | 黄色片在线看 | 欧美成人自拍视频 | 久草免费电影 | 免费观看一级特黄欧美大片 | 玖玖在线精品 | 日韩中文在线观看 | 精品日韩在线观看 | 在线观看成人小视频 | 国产91精品在线 | 欧美一级淫片007 | 久久亚 | 色一阁 | 国产成人在线播放 | 超级黄色一级片 |